﻿* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  font-family: "Inter", sans-serif;
}
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: #555;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
.hidden {
  display: none !important;
}
.main-container {
  width: 100%;
  background: var(--color-bg);
}
.filter-dropdown,
#keyword-search {
  font-size: 14px;
}
summary::marker {
  content: "";
}
details summary::-webkit-details-marker {
  display: none;
}
details summary {
  list-style: none;
}
details[open] summary .accordion-arrow {
  transform: rotate(180deg);
}
.accordion-arrow {
  transition: transform 0.2s ease-in-out;
}
.table-container {
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: auto;
  border-radius: 0.5rem;
  border: 1px solid var(--color-border);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  background: var(--color-bg-card);
}
.custom-btn {
  color: #fff;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px 0 rgb(0 0 0 / 0.06);
  transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out,
    color 0.15s ease-in-out;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  min-width: auto;
  font-size: 12px;
  line-height: 1.2;
  background-color: var(--color-accent-blue);
}
.custom-btn:focus {
  outline: 2px solid var(--color-accent-blue);
  outline-offset: 2px;
}
.search-reset-button {
  background-color: var(--color-accent-red);
  color: #ffffff !important;
}
.search-reset-button:hover {
  background-color: #dc2626;
  color: #ffffff !important;
}
.search-reset-button:focus {
  box-shadow: 0 0 0 2px #fca5a5, 0 0 0 4px #ef4444;
  color: #ffffff !important;
}
.selection-reset-button {
  background-color: var(--color-accent-orange);
  color: #ffffff !important;
}
.selection-reset-button:hover {
  background-color: #d97706;
  color: #ffffff !important;
}
.selection-reset-button:focus {
  box-shadow: 0 0 0 2px #fcd34d, 0 0 0 4px #f59e0b;
  color: #ffffff !important;
}
.gray-button {
  background-color: var(--color-gray);
  color: #ffffff !important;
}
.gray-button:hover {
  background-color: #4b5563;
  color: #ffffff !important;
}
.gray-button:focus {
  box-shadow: 0 0 0 2px #9ca3af, 0 0 0 4px #6b7280;
  color: #ffffff !important;
}
#global-optimization-btn {
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
  transition: all 0.2s ease;
  font-weight: 600;
  border: none;
  box-shadow: 0 2px 4px rgb(124 58 237 / 0.3);
}
#global-optimization-btn:hover {
  background: linear-gradient(135deg, #5b21b6, #4c1d95);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgb(124 58 237 / 0.4);
}
.optimization-btn {
  transition: all 0.2s;
}
.optimization-btn:hover {
  background: #f3f4f6;
}
.optimization-btn.active {
  background: #3b82f6 !important;
  color: white !important;
  border-color: #3b82f6 !important;
}
.filter-buttons {
  display: flex;
  gap: 4px;
}
.filter-btn {
  flex: 1;
  padding: 6px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--color-gray);
}
.filter-btn:hover {
  background: var(--color-bg-card);
  border-color: var(--color-gray);
}
.filter-btn.active {
  background: var(--color-accent-blue);
  color: #fff;
  border-color: var(--color-accent-blue);
  font-weight: 500;
}
.eiketsu-table {
  width: 100%;
  min-width: max-content;
  border-collapse: collapse;
}
.eiketsu-table th,
.eiketsu-table td {
  border-bottom: 1px solid var(--color-border);
  padding: 0.65rem 0.8rem;
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}
.eiketsu-table th {
  background-color: var(--color-bg-card);
  color: var(--color-text-sub);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 10;
  user-select: none;
}
.eiketsu-table th.sortable-header {
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.eiketsu-table th.sortable-header:hover {
  background-color: #f3f4f6;
}
.eiketsu-table th .sort-indicator {
  margin-left: 0.3em;
  font-size: 0.75em;
  display: inline-block;
  width: 1em;
  color: #374151;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}
.eiketsu-table tbody tr {
  position: relative;
}
.eiketsu-table tbody tr:nth-child(odd) {
  background-color: var(--color-bg);
}
.eiketsu-table tbody tr:nth-child(even) {
  background-color: var(--color-bg-card);
}
.eiketsu-table tbody tr.clickable {
  cursor: pointer;
}
.eiketsu-table tbody tr.clickable:hover {
  background-color: #f3f4f6;
}
.eiketsu-table tbody tr.selected {
  background: linear-gradient(90deg, #e0f2fe 80%, #bae6fd 100%) !important;
  color: var(--color-text-main) !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 8px rgb(52 152 219 / 0.1);
  transition: background 0.2s, box-shadow 0.2s;
}
.eiketsu-table tbody tr.selected:hover {
  background: linear-gradient(90deg, #bae6fd 80%, #e0f2fe 100%) !important;
  box-shadow: 0 4px 16px rgb(52 152 219 / 0.18);
}
.eiketsu-table tbody tr.selected td {
  color: var(--color-text-main) !important;
  font-weight: 700 !important;
  text-shadow: none;
  border: none !important;
}
.eiketsu-table td {
  color: var(--color-text-sub);
  font-size: 13.6px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.check-column {
  width: 2.5rem;
  text-align: center;
}
.check-mark {
  color: var(--color-accent-green);
  font-weight: 700;
  font-size: 16px;
}
.name-column {
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.job-column {
  white-space: nowrap;
}
.added-date-column {
  font-size: 10px;
  color: #6b7280;
  text-align: center;
  white-space: nowrap;
  width: 100px;
}
#resultsCount {
  font-size: 14px;
}
.eiketsu-table tbody tr.preview-hover {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%) !important;
  border-left: 4px solid #0ea5e9;
  transform: scale(1.01);
  box-shadow: 0 4px 12px rgb(14 165 233 / 0.2);
  transition: all 0.2s ease;
}
.preview-badge {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  z-index: 10;
  animation: fadeInBounce 0.3s ease-out;
}
.preview-badge.success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 2px 8px rgb(16 185 129 / 0.3);
}
.preview-badge.error {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  box-shadow: 0 2px 8px rgb(239 68 68 / 0.3);
}
.preview-badge.neutral {
  background: linear-gradient(135deg, #6b7280, #4b5563);
  color: #fff;
  box-shadow: 0 2px 8px rgb(107 114 128 / 0.3);
}
.summary-value.preview-highlight {
  animation: numberGlow 0.8s ease-in-out;
}
.preview-addition {
  color: #10b981;
  font-weight: 700;
  animation: scaleIn 0.3s ease-out;
}
.formation-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}
.formation-label {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
}
.formation-select {
  padding: 4px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #fff;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 80px;
}
.formation-select:hover {
  border-color: #9ca3af;
}
.formation-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgb(59 130 246 / 0.1);
}
.selected-eiketsu-container {
  position: relative;
  height: 280px;
  margin: 20px auto;
  transition: all 0.3s ease;
}
.formation-hoen .selected-eiketsu-container {
  height: 240px;
}
.formation-shoyaku .selected-eiketsu-container,
.formation-kakuyoku .selected-eiketsu-container {
  height: 260px;
}
.formation-gyorin .selected-eiketsu-container {
  height: 280px;
}
.selected-eiketsu-container svg line {
  stroke-dasharray: 3, 3;
  animation: dash 2s linear infinite;
}
.selected-eiketsu-container svg line.active-line {
  stroke-dasharray: 5, 5;
  animation: active-dash 1s linear infinite, glow-pulse 2s ease-in-out infinite;
  filter: drop-shadow(0 0 4px rgb(16 185 129 / 0.5));
  stroke: #10b981;
  stroke-width: 3;
  opacity: 1;
}
.formation-info {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: #6b7280;
  background: rgb(255 255 255 / 0.9);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
}
.selected-slot {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.selected-slot.empty {
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
}
.selected-slot.filled {
  border: 2px solid #3b82f6;
  background: #fff;
  box-shadow: 0 2px 4px rgb(0 0 0 / 0.05);
}
.selected-slot.filled:hover .slot-remove-btn {
  display: flex;
}
.selected-slot.filled:hover .drag-handle {
  display: flex;
}
.selected-slot.filled[draggable="true"] {
  cursor: grab;
}
.selected-slot.filled[draggable="true"]:active {
  cursor: grabbing;
}
.selected-slot.filled:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}
.selected-slot:hover {
  border-color: #3b82f6;
  transform: translate(-50%, -50%) scale(1.02);
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.1);
}
.selected-slot.active-slot {
  border: 2px solid #10b981 !important;
  background: #fff;
  box-shadow: 0 0 0 4px rgb(16 185 129 / 0.2), 0 4px 8px rgb(0 0 0 / 0.1);
  animation: slot-glow 2s ease-in-out infinite;
}
.selected-slot.active-slot .slot-number {
  background: #10b981 !important;
  color: #fff;
  animation: number-pulse 2s ease-in-out infinite;
}
.slot-number {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  background: #6b7280;
  color: #fff;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}
.selected-slot.filled .slot-number {
  background: #3b82f6;
}
.slot-content {
  text-align: center;
  width: 100%;
  padding: 2px;
}
.empty-icon {
  font-size: 24px;
  color: #cbd5e1;
}
.slot-eiketsu-name {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  word-break: break-all;
  color: #1f2937;
}
.slot-factors {
  font-size: 9px;
  color: #6b7280;
  line-height: 1.1;
  margin-top: 2px;
  word-break: break-all;
}
.slot-status {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  justify-content: flex-end;
  margin-top: 7px;
  position: absolute;
  bottom: 0;
}
.status-tag {
  font-size: 8px;
  padding: 2px;
  border-radius: 4px;
  color: #fff;
}
.status-tag.lb {
  background: var(--color-accent-purple);
  color: #fff;
}
.status-tag.trust {
  background: var(--color-accent-green);
  color: #fff;
}
.slot-remove-btn {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  background: #ef4444;
  color: #fff;
  border: 2px solid #fff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.2);
}
.over-limit {
  color: #ef4444 !important;
  font-weight: 600;
}
.drag-handle {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 16px;
  height: 16px;
  background: #6b7280;
  color: #fff;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  cursor: grab;
  z-index: 15;
  user-select: none;
}
.selected-slot.dragging {
  opacity: 0.7;
  transform: translate(-50%, -50%) scale(1.05);
  z-index: 1000;
  border: 2px dashed #3b82f6 !important;
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.2);
}
.selected-slot.dragging .slot-number {
  background: #3b82f6;
  color: #fff;
  font-weight: 700;
  z-index: 10;
}
.selected-slot.dragging .slot-factors {
  font-weight: 600;
  color: #1f2937;
}
.selected-slot.potential-drop-target {
  border: 2px dashed #10b981;
  background: rgb(16 185 129 / 0.1);
  animation: pulse-target 1.5s ease-in-out infinite;
}
.selected-slot.drop-target {
  border: 2px solid #10b981 !important;
  background: rgb(16 185 129 / 0.2) !important;
  transform: translate(-50%, -50%) scale(1.08);
  box-shadow: 0 0 0 4px rgb(16 185 129 / 0.3);
}
.selected-slot:not(.dragging):not(.drop-target) {
  transition: all 0.2s ease;
}
.selected-slot.drag-disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
.selected-slot.drag-disabled .drag-handle {
  display: none !important;
}
.drag-help-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgb(0 0 0 / 0.8);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  pointer-events: none;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.drag-help-overlay.show {
  opacity: 1;
}
.touch-dragging {
  opacity: 0.8;
  transform: scale(1.05) translate(-50%, -50%);
  z-index: 1000;
  border: 2px solid #3b82f6 !important;
  box-shadow: 0 10px 40px rgb(0 0 0 / 0.3);
}
.touch-drop-target {
  border: 3px solid #10b981 !important;
  background: rgb(16 185 129 / 0.1) !important;
  animation: bounce-target 0.6s ease-in-out infinite alternate;
}
[title] {
  cursor: help;
}
.placement-help {
  position: absolute;
  top: -5px;
  right: -5px;
  z-index: 20;
}
.help-icon {
  width: 18px;
  height: 18px;
  background: #6b7280;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: help;
}
.help-tooltip {
  position: absolute;
  top: 22px;
  right: 0;
  background: #333;
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 11px;
  width: 180px;
  display: none;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.3);
  white-space: normal;
  line-height: 1.3;
  z-index: 100;
}
.help-tooltip::before {
  content: "";
  position: absolute;
  top: -4px;
  right: 8px;
  width: 0;
  height: 0;
  border-left: 4px solid #fff0;
  border-right: 4px solid #fff0;
  border-bottom: 4px solid #333;
}
.placement-help:hover .help-tooltip {
  display: block;
}
.summary-box {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 12px 0;
  background: #f0f9ff;
  border-top: 1px solid #bae6fd;
  margin-top: 12px;
}
.summary-item {
  text-align: center;
}
.summary-label {
  font-size: 10px;
  color: #0369a1;
  margin-bottom: 2px;
  text-transform: uppercase;
}
.summary-value {
  font-size: 20px;
  font-weight: 700;
  color: #64748b;
}
.summary-value.active {
  color: #10b981;
}
.summary-value.cost {
  color: #f59e0b;
}
.summary-value.calculating {
  color: #6b7280;
}
.summary-value.improvable {
  border: 2px solid #ef4444;
  border-radius: 8px;
  padding: 4px 8px;
  background: linear-gradient(135deg, #fef2f2, #fee2e2);
}
.summary-value.optimal {
  border: 2px solid #10b981;
  border-radius: 8px;
  padding: 4px 8px;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
}
.inen-list {
  padding-top: 8px;
  max-height: 80vh;
  overflow-y: auto;
  scroll-behavior: smooth;
}
.inen-section {
  margin-bottom: 16px;
  scroll-margin-top: 20px;
}
.candidate-section {
  margin-top: 8px;
}
.section-title {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 2px solid #3b82f6;
}
.inen-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.inen-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 2px 5px rgb(0 0 0 / 0.08);
  transform: translateY(-1px);
}
.inen-card.activatable {
  background: #f0fdf4;
  border-left: 4px solid #10b981;
}
.inen-card.hidden {
  display: none;
}
.inen-card.preview-new-activation {
  background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
  border: 2px solid #10b981;
  animation: pulseGlow 1.5s ease-in-out infinite;
}
.inen-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}
.inen-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-grow: 1;
}
.inen-status-icon {
  font-size: 16px;
}
.inen-name {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
}
.inen-type {
  font-size: 10px;
  color: #6b7280;
  background: #e5e7eb;
  padding: 2px 6px;
  border-radius: 10px;
  align-self: center;
}
.inen-slots {
  font-size: 12px;
  color: #10b981;
  font-weight: 600;
  white-space: nowrap;
}
.inen-match {
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
}
.inen-factors {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.inen-factor {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  background: #e5e7eb;
  color: #374151;
}
.inen-factor.provided {
  background: #10b981;
  color: #fff;
}
.inen-factor.missing {
  background: #ef4444;
  color: #fff;
}
.inen-effects {
  font-size: 12px;
  color: #4b5563;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #e5e7eb;
}
.inen-help-section {
  margin-bottom: 16px;
}
.help-box {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  padding: 12px;
  font-size: 12px;
  color: #0c4a6e;
}
.help-box p {
  margin-bottom: 4px;
}
.help-box p:last-child {
  margin-bottom: 0;
}
.help-box strong {
  color: #075985;
}
.inen-formation-info {
  font-size: 10px;
  color: #6b7280;
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 8px;
  margin-left: 8px;
}
.active-section-compact,
.active-inen-compact {
  margin-bottom: 12px;
  padding: 8px 12px;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.1);
}
.section-title-compact,
.compact-header {
  font-size: 14px;
  font-weight: 600;
  color: #166534;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.compact-header::before {
  content: "✅";
  font-size: 16px;
}
.active-inen-tags,
.compact-inen-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  line-height: 1.3;
}
.active-inen-tag,
.compact-inen-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  background: #10b981;
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.active-inen-tag:hover,
.compact-inen-tag:hover {
  background: #059669;
  transform: scale(1.05);
}
.max-inen-section {
  margin-bottom: 16px;
}
.max-inen-display {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.max-inen-display:hover {
  background: #fde68a;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgb(0 0 0 / 0.1);
}
.max-inen-label {
  font-size: 12px;
  color: #92400e;
  margin-bottom: 4px;
}
.max-inen-value {
  font-size: 28px;
  font-weight: 700;
  color: #d97706;
}
.max-inen-hint {
  font-size: 10px;
  color: #b45309;
  margin-top: 4px;
}
.factor-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  color: #fff;
}
.factor-tag.providing {
  background: #059669;
  font-weight: 600;
  position: relative;
}
.factor-tag.providing::after {
  content: "●";
  position: absolute;
  top: -2px;
  right: -2px;
  font-size: 8px;
  color: #fbbf24;
  text-shadow: 0 0 2px rgb(0 0 0 / 0.5);
}
.factor-tag.relevant {
  background: #10b981;
}
.factor-tag.other {
  background: #e5e7eb;
  color: #6b7280;
}
.factor-tag.needed {
  background: #f59e0b;
}
.multi-factor-badge {
  font-size: 10px;
  padding: 2px 6px;
  background: #f59e0b;
  color: #fff;
  border-radius: 10px;
  font-weight: 600;
}
.factor-tags {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.enhanced-optimal-suggestion {
  position: relative;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
  border: 1px solid #93c5fd;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 3px rgb(59 130 246 / 0.1);
  max-height: none !important;
  overflow: visible !important;
  scroll-margin-top: 20px;
}
.enhanced-optimal-suggestion.expanded {
  max-height: 500px;
}
.enhanced-optimal-suggestion::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 20px;
  right: 20px;
  height: 1px;
  background: linear-gradient(to right, transparent, #cbd5e1, transparent);
}
.candidates-display-area {
  max-height: none !important;
  overflow: visible !important;
}
.candidate-category-compact {
  margin-bottom: 16px;
  transition: all 0.3s ease;
}
.candidate-category-compact:last-child {
  margin-bottom: 0;
}
.candidate-category-compact.has-more {
  position: relative;
}
.candidate-category-compact.has-more::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(to bottom, transparent, rgb(249 250 251 / 0.9));
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.candidate-category-compact.has-more:not(.expanded)::after {
  opacity: 1;
}
.hidden-card {
  display: none !important;
}
.candidate-grid-compact {
  transition: max-height 0.3s ease;
}
.candidate-grid-compact[data-category="contributors"] {
  position: relative;
}
#active-inen-section {
  margin-top: 16px;
  padding: 12px;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.1);
}
.sticky.top-6 {
  top: 1.5rem;
}
.summary-box + #active-inen-section {
  margin-top: 12px;
}
.candidate-grid-compact.fixed-height {
  max-height: 240px;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}
.candidate-grid-compact[data-category="contributors"] {
  position: relative;
}
.candidate-grid-compact[data-category="contributors"] {
  position: relative;
}
.candidate-grid-compact.expanded .compact-candidate-card {
  display: flex !important;
}
.expand-controls {
  text-align: center;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed #cbd5e1;
  position: relative;
  z-index: 10;
}
.expand-btn {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
}
.expand-btn:hover {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border-color: #94a3b8;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.1);
}
.expand-text {
  font-weight: 500;
}
.expand-count {
  font-size: 9px;
  color: #6b7280;
}
.expand-arrow {
  font-size: 8px;
  transition: transform 0.2s ease;
}
.enhanced-optimal-suggestion.expanded .expand-arrow {
  transform: rotate(180deg);
}
.category-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding: 6px 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  color: #1f2937 !important;
  font-weight: 600 !important;
}
.category-expand-btn:hover {
  background: #f3f4f6;
  border-color: #6b7280;
  color: #1f2937 !important;
}
.category-title-compact {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
  padding: 4px 8px;
  border-radius: 4px;
  display: inline-block;
}
.category-title-compact.high-impact {
  background: #dcfce7;
  color: #166534;
}
.category-title-compact.medium-impact {
  background: #fef3c7;
  color: #92400e;
}
.compact-candidate-card {
  min-height: 90px;
  padding: 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: fadeIn 0.3s ease-out;
  animation-fill-mode: both;
  margin-bottom: 5px;
}
.compact-candidate-card:hover {
  border-color: #10b981;
  box-shadow: 0 2px 4px rgb(16 185 129 / 0.1);
  transform: translateY(-1px);
}
.compact-candidate-card.high-impact {
  border-left: 3px solid #10b981;
}
.compact-candidate-card.medium-impact {
  border-left: 3px solid #f59e0b;
}
.compact-candidate-card:nth-child(1) {
  animation-delay: 0s;
}
.compact-candidate-card:nth-child(2) {
  animation-delay: 0.05s;
}
.compact-candidate-card:nth-child(3) {
  animation-delay: 0.1s;
}
.compact-candidate-card:nth-child(4) {
  animation-delay: 0.15s;
}
.compact-candidate-card:nth-child(5) {
  animation-delay: 0.2s;
}
.compact-suggestion-header {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #dbeafe;
}
.suggestion-title {
  font-size: 14px;
  font-weight: 600;
  color: #1e40af;
  margin-bottom: 4px;
}
.suggestion-stats {
  font-size: 11px;
  color: #6b7280;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.suggestion-explanation {
  font-size: 10px;
  color: #4b5563;
  margin-bottom: 12px;
  padding: 6px 8px;
  background: rgb(255 255 255 / 0.8);
  border-radius: 4px;
  border: 1px solid #e0e7ff;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.explanation-item {
  white-space: nowrap;
}
.compact-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.candidate-name-compact {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.2;
}
.candidate-meta-compact {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.job-badge-compact,
.cost-badge-compact {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  white-space: nowrap;
}
.job-badge-compact {
  background: #e5e7eb;
  color: #374151;
}
.cost-badge-compact {
  background: #fee2e2;
  color: #991b1b;
}
.compact-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.factor-display-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.factor-chip-compact {
  font-size: 10px;
  padding: 2px 6px;
  background: #f3f4f6;
  color: #374151;
  border-radius: 10px;
  white-space: nowrap;
}
.impact-display-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.impact-score-compact {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  white-space: nowrap;
}
.impact-score-compact.high {
  background: #10b981;
  color: #fff;
}
.impact-score-compact.medium {
  background: #f59e0b;
  color: #fff;
}
.impact-score-compact.low {
  background: #6b7280;
  color: #fff;
}
.modal,
.optimal-detail-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgb(0 0 0 / 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}
.modal[style*="display: flex"] {
  display: flex !important;
}
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgb(0 0 0 / 0.5);
  backdrop-filter: blur(4px);
}
.modal-content {
  background: #fff;
  border-radius: 8px;
  max-width: 1200px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.15);
  animation: fadeIn 0.2s ease-out;
  position: relative;
  border: 1px solid var(--color-border);
  box-shadow: 0 1px 3px 0 rgb(51 59 79 / 0.08);
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f9fafb;
}
.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: #1f2937;
}
.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #6b7280;
  line-height: 1;
  padding: 4px;
}
.modal-close:hover {
  color: #1f2937;
}
.modal-body,
#modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  line-height: 1.6;
  word-wrap: break-word;
  max-width: 100%;
}
.modal-footer {
  display: flex;
  gap: 12px;
  padding: 20px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}
.btn-cancel {
  flex: 1;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #f3f4f6;
  color: #374151;
}
.btn-cancel:hover {
  background: #e5e7eb;
}
.btn-apply {
  flex: 1;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
}
.btn-apply:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgb(16 185 129 / 0.3);
}
.modal.candidate-detail-modal .modal-content {
  max-width: 850px;
  width: 95%;
  max-height: 90vh;
}
.modal-content {
  background: #fff;
  border-radius: 8px;
  max-width: 1200px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.15);
  animation: fadeIn 0.2s ease-out;
  position: relative;
  border: 1px solid var(--color-border);
  box-shadow: 0 1px 3px 0 rgb(51 59 79 / 0.08);
}
@media (max-width: 768px) {
  .modal,
  .optimal-detail-modal {
    padding: 10px;
  }
  .modal-content {
    width: calc(100% - 20px);
    max-width: none;
    margin: 0 auto;
    border-radius: 8px;
  }
  .modal.candidate-detail-modal .modal-content {
    width: calc(100% - 20px);
    max-width: none;
  }
  .global-optimization-modal .modal-content,
  .global-results-modal .modal-content {
    width: calc(100% - 20px);
    max-width: none;
  }
  .modal-body,
  #modal-body {
    padding: 15px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .factor-analysis-list,
  .current-eiketsu-list,
  .candidate-eiketsu-list {
    grid-template-columns: 1fr !important;
    gap: 6px;
  }
  .candidate-inen-detail table,
  .candidate-inen-detail pre,
  .candidate-inen-detail code {
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
  }
  .candidate-inen-detail {
    word-break: break-word;
    overflow-wrap: break-word;
  }
  .modal-footer {
    padding: 15px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .modal-footer button {
    min-width: 100px;
    flex: 1 1 auto;
  }
  .eiketsu-table .name-column {
    white-space: normal;
    word-break: break-all;
  }
  #keyword-search {
    font-size: 16px;
  }
}
@media (max-width: 480px) {
  .modal,
  .optimal-detail-modal {
    padding: 5px;
  }
  .modal-content,
  .modal.candidate-detail-modal .modal-content,
  .global-optimization-modal .modal-content,
  .global-results-modal .modal-content {
    width: calc(100% - 10px);
    border-radius: 6px;
  }
  .modal-body,
  #modal-body {
    padding: 12px;
  }
  .candidate-inen-detail {
    font-size: 12px;
  }
  .modal-header h3 {
    font-size: 14px;
  }
}
@media (max-width: 768px) {
  .modal,
  .optimal-detail-modal {
    padding: 10px;
  }
  .modal-content {
    width: 100%;
    margin: 0;
    max-width: calc(100vw - 20px);
  }
  .modal.candidate-detail-modal .modal-content {
    width: 100%;
    max-width: calc(100vw - 20px);
  }
  .modal-body,
  #modal-body {
    padding: 15px;
    overflow-x: hidden;
    overflow-y: auto;
  }
  .factor-analysis-list {
    grid-template-columns: 1fr;
  }
  .current-eiketsu-list {
    grid-template-columns: 1fr;
  }
  .candidate-eiketsu-list {
    grid-template-columns: 1fr;
  }
  .candidate-inen-detail {
    overflow-x: hidden;
    word-wrap: break-word;
  }
  .candidate-inen-detail pre {
    white-space: pre-wrap;
    word-wrap: break-word;
  }
}
.candidate-detail-modal .modal-body {
  overflow-y: auto;
  flex: 1;
}
.candidate-inen-detail .section {
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid #e5e7eb;
}
.candidate-inen-detail .section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.candidate-inen-detail h4 {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.candidate-inen-detail h5 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}
.factor-analysis-list {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
.factor-analysis-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
}
.factor-analysis-item.can-provide {
  background: #f0fdf4;
  border-color: #86efac;
}
.factor-analysis-item.need-more {
  background: #fef2f2;
  border-color: #fca5a5;
}
.factor-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.factor-name {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
}
.factor-number {
  font-size: 11px;
  color: #6b7280;
  background: #e5e7eb;
  padding: 2px 6px;
  border-radius: 10px;
}
.provision-status {
  text-align: right;
}
.provider {
  font-size: 12px;
  color: #10b981;
  font-weight: 600;
}
.missing {
  font-size: 12px;
  color: #ef4444;
  font-weight: 500;
}
.current-eiketsu-list {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  margin-top: 8px;
}
.current-eiketsu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 12px;
  transition: all 0.2s ease;
  position: relative;
  padding-right: 36px;
  min-height: 40px;
}
.current-eiketsu-item:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}
.current-eiketsu-item.contributing {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
}
.current-eiketsu-item.contributing:hover {
  background: #e0f2fe;
  border-color: #7dd3fc;
}
.current-eiketsu-item .slot-number {
  background: #6b7280;
  color: #fff;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  font-weight: 500;
  min-width: 60px;
  text-align: center;
}
.current-eiketsu-item.contributing .slot-number {
  background: #3b82f6;
}
.current-eiketsu-item .eiketsu-name {
  font-weight: 600;
  color: #1f2937;
  min-width: 100px;
  flex-shrink: 0;
}
.current-eiketsu-item .factors {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
  justify-content: flex-end;
}
.current-eiketsu-item[style*="opacity: 0.5"] {
  background: #fafafa;
  border-style: dashed;
}
.current-eiketsu-item[style*="opacity: 0.5"] .eiketsu-name {
  color: #9ca3af;
  font-style: italic;
}
.eiketsu-remove-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  background: #ef4444;
  color: #fff;
  border: 2px solid #fff;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  opacity: 0.8;
  box-shadow: 0 2px 4px rgb(239 68 68 / 0.3);
}
.eiketsu-remove-btn:hover {
  background: #dc2626;
  opacity: 1;
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 3px 6px rgb(239 68 68 / 0.4);
}
.eiketsu-swap-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 26px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  border: 2px solid #fff;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  opacity: 0.85;
  box-shadow: 0 2px 4px rgb(59 130 246 / 0.3);
}
.eiketsu-swap-btn:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  opacity: 1;
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 3px 6px rgb(59 130 246 / 0.4);
}
@media (max-width: 768px) {
  .current-eiketsu-list {
    grid-template-columns: 1fr;
  }
  .current-eiketsu-item {
    padding: 8px 10px;
    font-size: 11px;
  }
  .current-eiketsu-item .eiketsu-name {
    min-width: 70px;
    font-size: 12px;
  }
  .current-eiketsu-item .factors {
    font-size: 10px;
  }
}
.current-eiketsu-item.contributing {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
}
.current-eiketsu-item .slot-number {
  background: #6b7280;
  color: #fff;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  white-space: nowrap;
  font-weight: 500;
}
.current-eiketsu-item.contributing .slot-number {
  background: #3b82f6;
}
.current-eiketsu-item .eiketsu-name {
  font-weight: 600;
  color: #1f2937;
  min-width: 80px;
}
.current-eiketsu-item .factors {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
}
.candidate-eiketsu-list {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.candidate-eiketsu-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 80px;
}
.candidate-eiketsu-item:hover {
  background: #f3f4f6;
  border-color: #3b82f6;
  transform: translateX(2px);
}
.candidate-eiketsu-item.high-score {
  background: #fef3c7;
  border-color: #fbbf24;
}
.candidate-eiketsu-item.high-score:hover {
  background: #fde68a;
}
.candidate-eiketsu-item .eiketsu-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.candidate-eiketsu-item .name {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
}
.candidate-eiketsu-item .job {
  font-size: 11px;
  color: #6b7280;
}
.candidate-eiketsu-item .eiketsu-stats {
  font-size: 10px;
  color: #059669;
  margin-top: 2px;
  font-weight: 500;
}
.candidate-eiketsu-item .owned-factors {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.composite-score-small {
  font-size: 9px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 4px;
  text-align: right;
}
.factor-duplication-notice {
  margin-top: 10px;
  padding: 8px 12px;
  background: #fef3c7;
  border: 1px solid #fbbf24;
  border-radius: 6px;
  font-size: 12px;
  color: #92400e;
}
.factor-duplication-notice strong {
  color: #78350f;
}
.inen-effect-summary .effect-content {
  color: #4b5563;
  font-size: 11px;
  line-height: 1.4;
}
.eiketsu-remove-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  opacity: 0.8;
}
.eiketsu-remove-btn:hover {
  background: #dc2626;
  opacity: 1;
  transform: translateY(-50%) scale(1.1);
}
.current-eiketsu-item[style*="opacity: 0.5"] .eiketsu-remove-btn {
  display: none;
}
.modal-candidate-section
  .candidate-grid:not(.expanded)
  .candidate-card:nth-child(n + 9) {
  display: none;
}
.modal-candidate-section {
  margin-top: 20px;
}
.modal-candidate-section h4 {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 12px;
}
.modal-candidate-section .candidate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.modal-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 12px;
  color: #1f2937;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.modal-expand-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}
.candidate-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.candidate-card:hover {
  border-color: #10b981;
  box-shadow: 0 2px 4px rgb(16 185 129 / 0.1);
  transform: translateY(-1px);
}
.candidate-card.high-impact {
  border-left: 3px solid #10b981;
}
.candidate-card.medium-impact {
  border-left: 3px solid #f59e0b;
}
.candidate-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.candidate-name {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.2;
}
.candidate-meta {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.job-badge,
.cost-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  white-space: nowrap;
}
.job-badge {
  background: #e5e7eb;
  color: #374151;
}
.cost-badge {
  background: #fee2e2;
  color: #991b1b;
}
.candidate-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.factor-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.factor-chip {
  font-size: 10px;
  padding: 2px 6px;
  background: #f3f4f6;
  color: #374151;
  border-radius: 10px;
  white-space: nowrap;
}
.factor-chip.providing {
  background: #10b981;
  color: #fff;
  font-weight: 600;
}
.impact-info {
  margin-top: 4px;
}
.impact-label {
  font-size: 11px;
  color: #059669;
  font-weight: 600;
}
.optimal-placement-item {
  margin-bottom: 8px;
  /*border-top: 1px solid #e5e7eb;*/
  padding-top: 8px;
}
.summary-box .optimal-placement-item:first-child {
  border-top: none;
  padding-top: 0;
}
.optimal-placement-item .summary-label {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
  text-align: center;
}
.optimal-placement-item .summary-value {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.optimal-calculating-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.calculating-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #e5e7eb;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
.calculating-text {
  color: #6b7280;
  font-size: 11px;
}
.optimal-progress-container {
  width: 100%;
  padding: 2px;
}
.progress-bar-container {
  position: relative;
  width: 100%;
  height: 16px;
  background: #f3f4f6;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 2px;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #1d4ed8);
  border-radius: 8px;
  transition: width 0.3s ease;
  position: relative;
}
.progress-bar::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgb(255 255 255 / 0.3),
    transparent
  );
  animation: shimmer 2s infinite;
}
.progress-percentage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgb(0 0 0 / 0.3);
  z-index: 1;
}
.progress-message {
  font-size: 10px;
  color: #6b7280;
  text-align: center;
}
.optimal-result.improvable {
  background: linear-gradient(135deg, #fef2f2, #fee2e2);
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  display: block;
  color: #ef4444;
  font-weight: 600;
}
.optimal-result.improvable:hover {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  transform: scale(1.02);
  box-shadow: 0 2px 8px rgb(239 68 68 / 0.2);
}
.optimal-result.optimal {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 6px 8px;
  width: 100%;
  display: block;
  color: #10b981;
  font-weight: 600;
}
.result-main {
  font-weight: 700;
  margin-bottom: 2px;
  color: #1f2937;
  font-size: 14px;
}
.result-improvement {
  font-size: 10px;
  color: #dc2626;
  font-weight: 500;
}
.result-status {
  font-size: 10px;
  color: #059669;
  font-weight: 500;
}
.optimal-error {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #ef4444;
  font-size: 11px;
  font-style: italic;
}
.retry-btn {
  background: #ef4444;
  color: #fff;
  border: none;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 9px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.retry-btn:hover {
  background: #dc2626;
}
.optimal-incomplete {
  color: #9ca3af;
  font-style: italic;
  font-size: 11px;
}
.global-optimization-modal .modal-content,
.global-results-modal .modal-content {
  max-width: 800px;
  width: 95%;
  max-height: 90vh;
}
.global-optimization-modal .modal-footer,
.global-results-modal .modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
.optimization-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
  margin: 16px 0;
}
.stat-item {
  text-align: center;
  padding: 12px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}
.stat-label {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 4px;
}
.stat-value {
  font-size: 18px;
  font-weight: 700;
  color: #7c3aed;
}
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgb(255 255 255 / 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s;
}
.loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f4f6;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}
.message-toast,
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 3000;
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.15);
}
.message-toast.show,
.notification.show {
  opacity: 1;
  transform: translateY(0);
}
.message-toast.success,
.notification.success {
  background: #10b981;
}
.message-toast.error,
.notification.error {
  background: #ef4444;
}
.message-toast.warning {
  background: #f59e0b;
  color: #1f2937;
}
.message-toast.info {
  background: #3b82f6;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes dash {
  to {
    stroke-dashoffset: -6;
  }
}
@keyframes active-dash {
  to {
    stroke-dashoffset: -10;
  }
}
@keyframes glow-pulse {
  0%,
  100% {
    filter: drop-shadow(0 0 4px rgb(16 185 129 / 0.5));
  }
  50% {
    filter: drop-shadow(0 0 8px rgb(16 185 129 / 0.8));
  }
}
@keyframes slot-glow {
  0%,
  100% {
    box-shadow: 0 0 0 4px rgb(16 185 129 / 0.2), 0 4px 8px rgb(0 0 0 / 0.1);
  }
  50% {
    box-shadow: 0 0 0 6px rgb(16 185 129 / 0.4), 0 6px 12px rgb(0 0 0 / 0.15);
  }
}
@keyframes number-pulse {
  0%,
  100% {
    transform: translateX(-50%) scale(1);
  }
  50% {
    transform: translateX(-50%) scale(1.1);
  }
}
@keyframes pulse-target {
  0%,
  100% {
    box-shadow: 0 0 0 2px rgb(16 185 129 / 0.3);
  }
  50% {
    box-shadow: 0 0 0 6px rgb(16 185 129 / 0.1);
  }
}
@keyframes bounce-target {
  from {
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    transform: translate(-50%, -50%) scale(1.05);
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes fadeInBounce {
  0% {
    opacity: 0;
    transform: translateY(-50%) scale(0.8);
  }
  60% {
    opacity: 1;
    transform: translateY(-50%) scale(1.05);
  }
  100% {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
}
@keyframes pulseGlow {
  0%,
  100% {
    box-shadow: 0 0 8px rgb(16 185 129 / 0.3);
  }
  50% {
    box-shadow: 0 0 16px rgb(16 185 129 / 0.6);
  }
}
@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes numberGlow {
  0%,
  100% {
    transform: scale(1);
    text-shadow: none;
  }
  50% {
    transform: scale(1.1);
    text-shadow: 0 0 8px rgb(16 185 129 / 0.6);
  }
}
@keyframes scaleIn {
  0% {
    transform: scale(0);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}
@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}
@media (min-width: 768px) {
  .filter-dropdown,
  #keyword-search {
    font-size: 0.875rem !important;
  }
}
@media (min-width: 1024px) {
  .main-container {
    width: 80%;
  }
}
@media (max-width: 768px) {
  .custom-btn {
    font-size: 11px;
    padding: 0.4rem 0.8rem;
  }
  .formation-selector {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .formation-select {
    width: 100%;
    min-width: unset;
  }
  .selected-eiketsu-container {
    height: 240px;
  }
  .eiketsu-table {
    min-width: 500px;
  }
  .eiketsu-table th {
    font-size: 11px;
  }
  .name-column {
    min-width: 80px;
    max-width: 80px;
  }
  .job-column {
    min-width: 50px;
    max-width: 50px;
  }
  .factor-column {
    min-width: 70px;
    max-width: 70px;
  }
  .preview-badge {
    font-size: 10px;
    padding: 3px 6px;
    right: 4px;
  }
  .preview-icon {
    font-size: 9px;
    padding: 1px 4px;
  }
  .optimal-placement-item .summary-value {
    font-size: 12px;
  }
  .result-main {
    font-size: 13px;
  }
  .modal-content {
    width: 95%;
    margin: 20px;
  }
  .candidate-grid-compact {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .candidate-grid-compact[data-category="contributors"]:not(.expanded)
    .compact-candidate-card:nth-child(n + 3) {
    display: none;
  }
  .table-container {
    max-height: 250px;
  }
}
@media (max-width: 640px) {
  .custom-btn {
    font-size: 10px;
    padding: 0.3rem 0.6rem;
  }
  .flex.items-center.space-x-3 {
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
  }
  .flex.items-center.space-x-3 > div {
    display: flex;
    gap: 8px;
  }
  .added-order-column,
  .sortable-header[data-column="addedOrder"] {
    display: none;
  }
  .table-container {
    max-height: 60vh;
  }
  .eiketsu-table th,
  .eiketsu-table td {
    font-size: 13.6px;
    padding: 0.5rem 0.75rem;
  }
}
.stats-content ul {
  list-style: disc;
  padding-left: 20px;
}
.stats-section {
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #e9ecef;
}
.stats-section h4 {
  margin: 0 0 12px 0;
  color: #212529;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.stats-item {
  background: #fff;
  padding: 12px;
  border-radius: 4px;
  text-align: center;
  border: 1px solid #dee2e6;
}
.stats-label {
  font-size: 12px;
  color: #6c757d;
  margin-bottom: 4px;
  display: block;
}
.stats-value {
  font-size: 24px;
  font-weight: 700;
  color: #3b82f6;
  display: block;
}
.stats-section .formation-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.formation-item {
  background: #fff;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  text-align: center;
}
.formation-item.current {
  background: #dbeafe;
  border-color: #3b82f6;
  font-weight: 600;
}
.formation-name {
  font-size: 12px;
  font-weight: 500;
  color: #1f2937;
}
.formation-desc {
  font-size: 10px;
  color: #6b7280;
  margin-top: 2px;
}
.formation-info {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: #6b7280;
  background: rgb(255 255 255 / 0.9);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
}
.compact-candidate-card.hidden-card {
  display: none !important;
}
.candidate-grid-compact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  padding: 8px 0;
  max-height: none !important;
  overflow: visible !important;
}
.category-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding: 6px 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  color: #1f2937 !important;
  font-weight: 600 !important;
}
.category-expand-btn:hover {
  background: #f3f4f6;
  border-color: #6b7280;
  color: #1f2937 !important;
}
@media (max-width: 768px) {
  .candidate-grid-compact {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}
@media (prefers-contrast: high), (forced-colors: active) {
  .compact-summary {
    border: 2px solid currentColor;
  }
  .compact-summary .summary-value {
    color: currentColor;
  }
}
.compact-summary {
  margin-top: 8px;
  padding: 8px;
  background: rgb(255 255 255 / 0.9);
  border-radius: 6px;
  border: 1px solid #e5e7eb;
}
.compact-summary .summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-size: 12px;
  line-height: 1.3;
}
.compact-summary .summary-item:last-child {
  margin-bottom: 0;
}
.compact-summary .summary-label {
  font-weight: 500;
  color: #6b7280;
  font-size: 11px;
}
.compact-summary .summary-value {
  font-weight: 600;
  color: #374151;
  font-size: 11px;
}
.compact-summary .summary-value.cost {
  color: #059669;
}
.compact-summary .summary-value.active {
  color: #10b981;
}
.compact-summary .optimal-incomplete {
  color: #6b7280;
  font-size: 10px;
}
@media (max-width: 768px) {
  .compact-summary {
    padding: 6px;
  }
  .compact-summary .summary-item {
    font-size: 11px;
  }
  .compact-summary .summary-label,
  .compact-summary .summary-value {
    font-size: 10px;
  }
}
.selected-slot {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}
.touch-dragging {
  transform: scale(1.05) !important;
  box-shadow: 0 8px 25px rgb(59 130 246 / 0.4) !important;
  border: 2px solid #3b82f6 !important;
  z-index: 9999 !important;
  pointer-events: none !important;
}
.touch-drop-target {
  background: rgb(59 130 246 / 0.2) !important;
  border: 2px dashed #3b82f6 !important;
  transform: scale(1.02);
  transition: all 0.2s ease;
}
.dragging {
  opacity: 0.7 !important;
  transform: scale(0.95);
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.3);
}
@media (max-width: 768px) {
  .selected-slot {
    min-height: 44px;
    position: relative;
  }
  .selected-slot:active {
    background: rgb(59 130 246 / 0.1);
    transition: background 0.1s ease;
  }
  .drag-handle {
    display: flex !important;
    opacity: 0.7;
  }
  .selected-eiketsu-container {
    gap: 8px;
  }
}
.selected-eiketsu-container {
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.selected-slot {
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
}
.touch-dragging {
  opacity: 0.85 !important;
  transform: scale(1.02) !important;
  z-index: 9999 !important;
  border: 2px solid #3b82f6 !important;
  box-shadow: 0 8px 32px rgb(59 130 246 / 0.4) !important;
  border-radius: 12px !important;
  animation: none !important;
  transition: none !important;
}
.touch-drop-target {
  border: 3px solid #10b981 !important;
  background: rgb(16 185 129 / 0.15) !important;
  box-shadow: 0 0 0 4px rgb(16 185 129 / 0.2) !important;
  transform: translate(-50%, -50%) scale(1.05) !important;
  animation: touch-pulse 0.8s ease-in-out infinite alternate !important;
}
@keyframes touch-pulse {
  0% {
    box-shadow: 0 0 0 4px rgb(16 185 129 / 0.2);
  }
  100% {
    box-shadow: 0 0 0 8px rgb(16 185 129 / 0.1);
  }
}
.selected-slot.dragging {
  opacity: 0.5 !important;
  transform: translate(-50%, -50%) scale(0.95) !important;
}
.mobile-delete-btn {
  touch-action: manipulation !important;
  min-width: 28px !important;
  min-height: 28px !important;
  transition: transform 0.1s ease, background-color 0.1s ease !important;
}
.mobile-delete-btn:active {
  transform: scale(0.9) !important;
  background-color: #dc2626 !important;
}
@media (max-width: 768px) {
  .selected-slot {
    min-width: 90px;
    min-height: 90px;
  }
  .drag-handle {
    display: flex !important;
    width: 24px !important;
    height: 24px !important;
    bottom: -12px !important;
    background: #4b5563 !important;
    box-shadow: 0 2px 8px rgb(0 0 0 / 0.3) !important;
  }
  .message-toast {
    z-index: 10000 !important;
  }
  .selected-slot.empty:active {
    transform: translate(-50%, -50%) scale(0.98);
    background: rgb(99 102 241 / 0.1);
  }
}
.selected-slot,
.touch-dragging,
.touch-drop-target {
  will-change: transform, opacity, box-shadow;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}
.selected-eiketsu-container {
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  transform: translateZ(0);
  will-change: scroll-position;
}
.selected-slot {
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  contain: layout style paint;
  transform: translateZ(0);
  transition: filter 0.1s ease;
}
.touch-dragging {
  opacity: 0.8 !important;
  z-index: 9999 !important;
  border: 2px solid #3b82f6 !important;
  border-radius: 8px !important;
  will-change: transform !important;
  transform: translate3d(0, 0, 0) scale(1.02) !important;
  animation: none !important;
  transition: none !important;
  contain: strict;
  box-shadow: 0 4px 16px rgb(59 130 246 / 0.25) !important;
}
.touch-drop-target {
  border: 3px solid #10b981 !important;
  background: rgb(16 185 129 / 0.1) !important;
  transform: translate(-50%, -50%) scale(1.03) !important;
  animation: touch-pulse-light 1s ease-in-out infinite alternate !important;
  will-change: transform;
  contain: layout;
}
@keyframes touch-pulse-light {
  0% {
    box-shadow: 0 0 0 2px rgb(16 185 129 / 0.3);
  }
  100% {
    box-shadow: 0 0 0 6px rgb(16 185 129 / 0.1);
  }
}
.selected-slot.dragging {
  opacity: 0.3 !important;
  filter: brightness(0.8);
  contain: strict;
}
.potential-drop-target {
  border: 2px dashed #10b981 !important;
  background: rgb(16 185 129 / 0.05) !important;
  animation: none !important;
}
.mobile-delete-btn {
  touch-action: manipulation !important;
  min-width: 28px !important;
  min-height: 28px !important;
  transition: transform 0.1s ease !important;
  will-change: transform;
  contain: layout;
}
.mobile-delete-btn:active {
  transform: scale(0.95) !important;
  background-color: #dc2626 !important;
}
@media (max-width: 768px) {
  .selected-slot {
    min-width: 85px;
    min-height: 85px;
    -webkit-tap-highlight-color: #fff0;
    -webkit-transform: translateZ(0);
  }
  .drag-handle {
    display: flex !important;
    width: 22px !important;
    height: 22px !important;
    bottom: -10px !important;
    background: #4b5563 !important;
    box-shadow: 0 1px 4px rgb(0 0 0 / 0.2) !important;
    transform: translateZ(0);
  }
  .message-toast {
    z-index: 10000 !important;
    will-change: transform, opacity;
    contain: layout;
  }
  .selected-slot.empty:active {
    transform: translate(-50%, -50%) scale(0.99);
    background: rgb(99 102 241 / 0.05);
  }
}
@media (prefers-reduced-motion: reduce) {
  .touch-drop-target,
  .potential-drop-target,
  .selected-slot,
  .mobile-delete-btn {
    animation: none !important;
    transition: none !important;
  }
  .touch-drop-target {
    box-shadow: 0 0 0 4px rgb(16 185 129 / 0.3) !important;
  }
}
.selected-slot,
.touch-dragging,
.touch-drop-target,
.potential-drop-target {
  contain: layout style;
  isolation: isolate;
}
#global-optimization-btn,
.auto-compose-button,
button[onclick*="autoCompose"] {
  display: none !important;
}
.owned-heroes-help {
  background-color: #f5f5f5;
  padding: 15px;
  border-radius: 5px;
  margin-bottom: 20px;
}
.device-instructions {
  margin: 10px 0;
}
.device-instructions h4 {
  margin-bottom: 5px;
  color: #333;
}
.device-instructions ol {
  margin-left: 20px;
  font-size: 0.9em;
}
.hero-card.dragging,
.selected-slot.dragging {
  will-change: transform;
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  pointer-events: none;
}
@media (hover: none) and (pointer: coarse) {
  .hero-card,
  .selected-slot {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    touch-action: none;
  }
  .touch-dragging {
    will-change: transform !important;
    transform: translate3d(0, 0, 0) !important;
    -webkit-transform: translate3d(0, 0, 0) !important;
  }
}
.selected-eiketsu-container {
  transform: translateZ(0);
  will-change: scroll-position;
}
#autoComposeButton,
.auto-compose-button,
button[onclick*="autoCompose"],
button[onclick*="全英傑から自動編成"],
button[onclick*="全英傑から"],
button[onclick*="自動編成"] {
  display: none !important;
}
#global-optimization-btn {
  display: none !important;
}
#reset-owned-collection {
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
#reset-owned-collection:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgb(0 0 0 / 0.1);
}
#reset-owned-collection:active {
  transform: translateY(1px);
}
#reset-owned-collection.processing {
  position: relative;
  color: #fff0;
}
#reset-owned-collection.processing::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin: -8px 0 0 -8px;
  border: 2px solid rgb(255 255 255 / 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: button-spinner 0.6s linear infinite;
}
@keyframes button-spinner {
  to {
    transform: rotate(360deg);
  }
}
#reset-owned-collection:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.eiketsu-table tbody tr.owned-eiketsu {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%) !important;
  border-left: 4px solid #0ea5e9 !important;
  font-weight: 500;
  position: relative;
}
.eiketsu-table tbody tr.owned-eiketsu:hover {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%) !important;
  transform: translateX(2px);
  transition: all 0.2s ease;
}
.eiketsu-table tbody tr.owned-eiketsu::after {
  content: "✓";
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: #0ea5e9;
  font-weight: 700;
  font-size: 16px;
  z-index: 1;
}
.eiketsu-table tbody tr.shift-clicked {
  animation: ownedToggle 0.3s ease-out;
}
@keyframes ownedToggle {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
    background-color: #3b82f6;
    color: #fff;
  }
  100% {
    transform: scale(1);
  }
}
#collection-badge,
#owned-count,
#collection-badge-formation-area {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #fff;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  display: inline-block;
  box-shadow: 0 1px 3px rgb(14 165 233 / 0.3);
}
@media (prefers-contrast: high), (forced-colors: active) {
  .eiketsu-table tbody tr.owned-eiketsu {
    background: #e0f2fe !important;
    border-left: 4px solid #0ea5e9 !important;
  }
  .eiketsu-table tbody tr.owned-eiketsu::after {
    color: #0ea5e9;
  }
}
@media (prefers-reduced-motion: reduce) {
  .eiketsu-table tbody tr.owned-eiketsu:hover {
    transform: none;
  }
  .eiketsu-table tbody tr.shift-clicked {
    animation: none;
  }
}
.touch-feedback {
  animation: touchPulse 0.3s ease-out;
}
@keyframes touchPulse {
  0% {
    transform: scale(1);
    background-color: rgb(99 102 241 / 0.1);
  }
  50% {
    transform: scale(0.98);
    background-color: rgb(99 102 241 / 0.2);
  }
  100% {
    transform: scale(1);
    background-color: #fff0;
  }
}
@media (hover: none) and (pointer: coarse) {
  .eiketsu-table tbody tr {
    -webkit-tap-highlight-color: rgb(99 102 241 / 0.2);
    touch-action: manipulation;
  }
  .eiketsu-table tbody tr:active {
    background-color: rgb(99 102 241 / 0.05);
    transition: background-color 0.1s;
  }
}
.eiketsu-table tbody tr.long-press-active {
  background-color: rgb(16 185 129 / 0.1) !important;
  box-shadow: inset 0 0 0 2px rgb(16 185 129 / 0.3);
}
.status-tag.bunkoku {
  background-color: #eef2ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
}
.long-press-feedback {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgb(59 130 246 / 0.2);
  border: 2px solid #3b82f6;
  pointer-events: none;
  z-index: 1000;
}
.long-press-feedback-success {
  background: rgb(16 185 129 / 0.3) !important;
  border-color: #10b981 !important;
}
@keyframes longPressGrow {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
  }
  20% {
    transform: translate(-50%, -50%) scale(0.3);
    opacity: 0.8;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.6;
  }
}
@keyframes longPressSuccess {
  0% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.2);
  }
  100% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
  }
}
.eiketsu-row.long-pressing {
  background-color: rgb(59 130 246 / 0.1);
  transition: background-color 0.2s ease;
}
.eiketsu-table.scrolling .long-press-feedback {
  display: none;
}
.reset-owned-btn {
  background-color: #ef4444;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  margin-left: 8px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.reset-owned-btn:hover {
  background-color: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgb(0 0 0 / 0.1);
}
.reset-owned-btn:active {
  transform: translateY(0);
  box-shadow: none;
}
.reset-owned-btn i {
  font-size: 14px;
}
.owned-column {
  position: relative;
  pointer-events: none;
}
.owned-checkbox {
  pointer-events: auto;
  position: relative;
  z-index: 10;
}
#total-boosts-display .total-boosts-title {
  font-size: 14px;
  font-weight: 600;
  color: #0369a1;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 8px;
}
#total-boosts-display .title-supplement {
  font-size: 10px;
  background: #dbeafe;
  color: #1e40af;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}
#total-boosts-display .title-note {
  font-size: 10px;
  background: #fef3c7;
  color: #b45309;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}
#total-boosts-display .boosts-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
#total-boosts-display .boosts-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#total-boosts-display .boost-item {
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#total-boosts-display .boost-item > strong {
  color: #1f2937;
  font-weight: 500;
}
#total-boosts-display .boost-item .value {
  font-weight: 600;
  color: #374151;
}
#total-boosts-display .boost-item .value.has-bonus {
  color: #2563eb;
}
#total-boosts-display .no-boosts-message {
  color: #6b7280;
  font-size: 13px;
  text-align: center;
  padding: 8px 0;
}
#copy-team-button {
  background-color: #10b981;
}
#copy-team-button:hover {
  background-color: #059669;
}
#share-url-btn,
#guide-btn,
#stats-btn,
#show-library-btn {
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-shadow: 0 1px 2px rgb(0 0 0 / 0.2);
  transition: all 0.2s ease-in-out;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1),
    inset 0 1px 1px 0 rgb(255 255 255 / 0.1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
}
#share-url-btn:hover,
#guide-btn:hover,
#stats-btn:hover,
#show-library-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px -1px rgb(0 0 0 / 0.15), 0 2px 6px -2px rgb(0 0 0 / 0.1);
}
#share-url-btn,
#guide-btn,
#stats-btn {
  background: linear-gradient(145deg, #3b82f6, #2563eb);
}
#show-library-btn {
  background: linear-gradient(145deg, #8b5cf6, #6d28d9);
}
.boost-item {
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.boost-item > strong {
  color: #1f2937;
  font-weight: 600;
}
.boost-item .value {
  font-weight: 600;
  color: #1f2937;
}
.boost-item .value.has-bonus {
  color: #2563eb;
  font-weight: 700;
}
#copy-team-button {
  background-color: #10b981;
}
#copy-team-button:hover {
  background-color: #059669;
}
#copy-team-button {
  background-color: #10b981;
}
#copy-team-button:hover {
  background-color: #059669;
}
.boost-item strong > strong {
  color: var(--color-accent-blue);
}
.boost-item {
  font-size: 14px;
  display: flex;
  justify-content: space-between;
}
.boost-item .value {
  font-weight: 600;
  color: #374151;
}
.boost-item .value.has-bonus {
  color: #2563eb;
}
#copy-team-button {
  background-color: #10b981;
}
#copy-team-button:hover {
  background-color: #059669;
}
.boost-item {
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.boost-item > strong {
  color: #1f2937;
  font-weight: 600;
}
.boost-item .value {
  font-weight: 600;
  color: #1f2937;
}
.boost-item .value.has-bonus {
  color: #2563eb;
  font-weight: 700;
}
#copy-team-button {
  background-color: #10b981;
}
#copy-team-button:hover {
  background-color: #059669;
}
.formation-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.05);
}
.formation-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}
.formation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
#total-boosts-display h4.total-boosts-title {
  font-size: 14px;
  font-weight: 600;
  color: #4b5563;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}
#total-boosts-display .boosts-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
#total-boosts-display .boost-item > strong {
  color: #1f2937;
  font-weight: 600;
}
#total-boosts-display .boost-item .value {
  font-weight: 500;
  color: #1f2937;
}
#total-boosts-display .boost-item .value.has-bonus {
  font-weight: 700;
  color: #2563eb;
}
.bond-map-content {
  background-color: #0d1117;
  color: #c9d1d9;
  padding: 1rem;
  border-radius: 6px;
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre;
  overflow-x: auto;
}
#show-bond-map-btn {
  background-color: #6d28d9;
}
#show-bond-map-btn:hover {
  background-color: #5b21b6;
}
.boost-item .value {
  font-weight: 500;
  color: #1f2937;
}
.boost-item .value.has-bonus {
  font-weight: 700;
  color: #2563eb;
}
.no-boosts-message {
  color: #6b7280;
  font-size: 13px;
  text-align: center;
  padding: 8px 0;
}
.recommendation-sort-header {
  display: flex;
  justify-content: space-between;
  padding: 4px 8px;
  margin-top: 8px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 12px;
  color: #4b5563;
}
.sort-col.sortable {
  cursor: pointer;
  font-weight: 600;
}
.sort-col.sortable:hover {
  color: #1d4ed8;
}
.compact-candidate-card .candidate-name-compact {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: #fff0;
  transition: text-decoration-color 0.2s;
}
.compact-candidate-card:hover .candidate-name-compact {
  text-decoration-color: #3b82f6;
}
.stats-grid-modal {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
  font-size: 13px;
}
@media (min-width: 769px) {
  .exploration-modal-stats-container {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 16px !important;
  }
  .stats-left-column,
  .stats-right-column {
    width: 100%;
  }
}
@media (max-width: 768px) {
  .exploration-modal-stats-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
  }
  .stats-left-column,
  .stats-right-column {
    width: 100% !important;
    box-sizing: border-box !important;
  }
  #exploration-heroes-list > div {
    padding: 10px !important;
    margin-bottom: 12px !important;
  }
  .exploration-bulk-btn {
    padding: 4px 8px !important;
    font-size: 11px !important;
    min-height: 28px !important;
  }
  input[type="range"] {
    height: 6px !important;
    margin: 2px 0 !important;
  }
  label {
    font-size: 12px !important;
    margin-bottom: 4px !important;
  }
  span[id*="exploration-value-"] {
    font-size: 12px !important;
    min-width: 24px !important;
  }
}
@media (max-width: 480px) {
  .exploration-modal-stats-container {
    gap: 6px !important;
  }
  #exploration-heroes-list > div {
    padding: 8px !important;
  }
  .exploration-bulk-btn {
    padding: 3px 6px !important;
    font-size: 10px !important;
  }
}
.community-modal-content {
  width: 90%;
  max-width: 1200px;
  height: 80vh;
  display: flex;
  flex-direction: column;
}
.community-tabs {
  display: flex;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 15px;
}
.tab-btn {
  padding: 10px 15px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  border-bottom: 2px solid #fff0;
}
.tab-btn.active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
}
.submission-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.submission-form input,
.submission-form textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
}
.submission-form textarea {
  min-height: 80px;
  resize: vertical;
}
.formation-card-grid {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.formation-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #f3f4f6;
  padding-bottom: 10px;
}
.inen-badge {
  background: #dbeafe;
  color: #1e40af;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.formation-title {
  font-size: 16px;
  font-weight: 700;
  color: #1f2937;
}
.author-name {
  font-size: 13px;
  color: #4b5563;
}
.eiketsu-icons {
  display: flex;
  gap: 4px;
}
.eiketsu-icons span {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 500;
}
.eiketsu-icons span.empty {
  background: #e5e7eb;
}
.comment {
  font-size: 12px;
  color: #6b7280;
  flex-grow: 1;
  background: #f9fafb;
  padding: 8px;
  border-radius: 4px;
}
.ranking-list {
  font-size: 14px;
}
.ranking-header,
.ranking-row {
  display: grid;
  grid-template-columns: 60px 1fr 80px;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid #e5e7eb;
  align-items: center;
}
.ranking-header {
  font-weight: 600;
  color: #4b5563;
}
.ranking-row .rank {
  font-weight: 700;
}
.ranking-row .count {
  text-align: right;
}
.loading-spinner {
  border: 4px solid #f3f4f6;
  border-top: 4px solid #3b82f6;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 40px auto;
}
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
.no-data {
  text-align: center;
  padding: 40px;
  color: #6b7280;
}
.btn-import,
.btn-apply {
  background: #10b981;
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  font-weight: 500;
  text-align: center;
}
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid #f3f4f6;
}
.btn-like {
  background: #f3f4f6;
  color: #4b5563;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid #e5e7eb;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
}
.btn-like:hover {
  background: #e5e7eb;
}
.btn-like.liked {
  background: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
  cursor: not-allowed;
}
.formation-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 0;
  transition: box-shadow 0.2s ease;
}
.formation-card:hover {
  box-shadow: 0 4px 10px rgb(0 0 0 / 0.05);
}
.formation-card-summary {
  padding: 15px;
}
.summary-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.card-footer.summary-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
  padding-top: 0;
  border-top: none;
}
.details-toggle {
  background: none;
  border: 1px solid #d1d5db;
  color: #4b5563;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}
.details-toggle:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}
.formation-card-details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease-out, padding 0.4s ease-out;
  padding: 0 15px;
  border-top: 1px solid #f3f4f6;
}
.formation-card.expanded .formation-card-details {
  max-height: 1000px;
  padding: 15px 15px;
  transition: max-height 0.5s ease-in, padding 0.5s ease-in;
}
.detail-section {
  margin-bottom: 15px;
}
.detail-section:last-child {
  margin-bottom: 0;
}
.detail-section h6 {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #e5e7eb;
}
.member-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.member-item {
  background: #f9fafb;
  padding: 8px;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.member-item.empty {
  color: #9ca3af;
  justify-content: center;
}
.member-name {
  font-weight: 500;
}
.member-job {
  color: #6b7280;
}
.member-cost {
  font-weight: 600;
  background: #e5e7eb;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 11px;
}
.bottom-actions {
  text-align: right;
}
.comment {
  flex-grow: 0;
}
.card-footer {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}
.eiketsu-icons span {
  width: 32px;
  height: 32px;
  font-size: 12px;
}
.loading-spinner-small {
  border: 3px solid #f3f4f6;
  border-top: 3px solid #3b82f6;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 1s linear infinite;
  margin: 10px auto;
}
.stat-boost-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
.stat-boost-column {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-boost-item {
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid #f1f5f9;
}
.stat-boost-item strong {
  color: #0ea5e9;
}
.stat-boost-item {
  background: #f8fafc;
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid #f1f5f9;
}
.stat-boost-item strong {
  color: #0ea5e9;
}
.inen-list-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.inen-list-tag {
  background: #dcfce7;
  color: #166534;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 12px;
}
.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e5e7eb;
}
.category-filter-btn {
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #4b5563;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}
.category-filter-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}
.category-filter-btn.active {
  background: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
}
.summary-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.category-tag {
  background: #fee2e2;
  color: #991b1b;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  white-space: nowrap;
}
.member-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
.member-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f9fafb;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 13px;
}
.member-name {
  font-weight: 600;
}
.member-meta {
  display: flex;
  gap: 8px;
  align-items: center;
}
.member-job {
  font-size: 12px;
  color: #6b7280;
}
.member-cost {
  font-size: 12px;
  font-weight: 500;
  background: #e5e7eb;
  padding: 2px 6px;
  border-radius: 4px;
}
.no-data-small {
  font-size: 12px;
  color: #6b7280;
  padding: 10px 0;
}
.trends-btn {
  background: linear-gradient(145deg, #10b981, #059669);
}
.inen-badge {
  display: inline-block;
  background: #dbeafe;
  color: #1e40af;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.likes-badge {
  display: inline-block;
  background: #fef2f2;
  color: #991b1b;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  margin-left: 4px;
}
.eiketsu-name-chip {
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 16px;
}
.header-area.custom-btn {
  padding: 8px 18px;
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  background-color: var(--color-gray);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.1);
}
.header-area.custom-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 6px rgb(0 0 0 / 0.1);
  filter: brightness(110%);
}
.header-area.custom-btn:active {
  transform: translateY(0);
  filter: brightness(95%);
}
@media screen and (max-width: 768px) {
  .community-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .community-tabs .tab-btn {
    flex-grow: 1;
    min-width: calc(50% - 6px);
  }
  .category-filters {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .category-filters .category-filter-btn {
    width: auto;
    margin: 0;
  }
  header .flex.gap-2 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: 100%;
  }
  header .custom-btn {
    width: 100%;
    margin: 0;
    padding: 10px 5px;
    font-size: 11px;
  }
}
.header-area .custom-btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid #d1d5db;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  background-color: #f8fafc;
  color: #334155;
}
.header-area .custom-btn:hover {
  background-color: #f1f5f9;
  border-color: #94a3b8;
  transform: translateY(-1px);
}
.header-actions-container {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
}
.action-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.action-group-title {
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
  padding-left: 4px;
}
.action-group .buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.action-group .custom-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid #d1d5db;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  text-decoration: none;
  background-color: #f9fafb;
  color: #374151;
}
.action-group .custom-btn:hover {
  background-color: #f3f4f6;
  border-color: #9ca3af;
}
.action-group .custom-btn svg {
  width: 16px;
  height: 16px;
}
.button-group.action-group {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.button-group.action-group .formation-btn {
  flex-grow: 1;
  min-width: 50px;
}
.button-group.action-group {
  display: flex;
  gap: 8px;
}
#copy-team-button {
  background: #4b5563;
}
#copy-team-button:hover {
  background: #374151;
}
#exploration-settings-btn {
  background: #d97706;
}
#exploration-settings-btn:hover {
  background: #b45309;
}
.formation-controls-wrapper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.formation-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}
.button-group-wrapper {
  display: flex;
  gap: 8px;
}
.formation-btn {
  padding: 6px 12px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  color: #fff;
}
#exploration-settings-btn {
  background: #d97706;
}
#exploration-settings-btn:hover {
  background: #b45309;
}
.summary-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.author-info {
  font-size: 11px;
  color: #6b7280;
}
.submission-date {
  color: #9ca3af;
}
.community-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 5px 15px 5px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 10px;
}
.community-header p {
  font-size: 13px;
  color: #4b5563;
}
.btn-submit-header {
  background: #2563eb;
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-submit-header:hover {
  background: #1d4ed8;
}
.btn-like {
  padding: 6px 10px;
}
.details-toggle {
  padding: 6px 12px;
}
.tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.new-badge {
  background-color: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1.2;
  animation: pulse-new 1.5s infinite;
}
@keyframes pulse-new {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}
.formation-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.filter-btn {
  padding: 8px 16px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #4b5563;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}
.filter-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}
.filter-btn.active {
  background: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.1);
}
.combo-card {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  background: #fff;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
}
.plus-sign {
  color: #9ca3af;
}
.combo-count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: #1e40af;
  background: #dbeafe;
  padding: 2px 8px;
  border-radius: 10px;
}

#show-submission-modal-btn:disabled {
  background-color: #6b7280;
  cursor: not-allowed;
  opacity: 0.6;
}

#show-submission-modal-btn:disabled:hover {
  background-color: #6b7280;
}

/* =====================================================
 * AI Support Styles - Consolidated from ai-support/
 * ===================================================== */

/* --- collection-manager.css --- */
/**
 * 保有英傑管理システム - 専用スタイル
 * 
 * 【適用範囲】
 * - 保有英傑の所有状況表示
 * - データ保存モーダル
 * - 保有英傑管理UI
 */

/* === 放浪娘カラースキーム === */
:root {
  --color-bg: #ffffff;
  --color-bg-card: #f9fafb;
  --color-border: #e5e7eb;
  --color-text-main: #333b4f;
  --color-text-sub: #374151;
  --color-accent-red: #e74c3c;
  --color-accent-blue: #3498db;
  --color-accent-green: #2ecc71;
  --color-accent-purple: #9b59b6;
  --color-accent-orange: #f39c12;
  --color-gray: #6b7280;
  --color-gray-light: #f3f4f6;
  --color-table-stripe: #f5f5f5;
}

/* === 所有状況表示 === */
.owned-eiketsu {
  position: relative;
  border-color: #10b981 !important;
  background-color: #f0fdf4;
}

.ownership-mark {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: #10b981;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
  z-index: 10;
}

/* === 保有数バッジ === */
#collection-badge {
  display: inline-block;
  background: #3b82f6;
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  margin-left: 8px;
}

/* === 保存モーダル === */
.save-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.save-modal .modal-content {
  background: white;
  border-radius: 8px;
  padding: 24px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.save-modal h3 {
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 12px;
}

.save-modal h4 {
  font-size: 16px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 8px;
  margin-top: 16px;
}

.save-modal p {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 16px;
}

.save-option {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 12px;
  background: #f9fafb;
}

.save-option input[type="text"] {
  width: 100%;
  padding: 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 12px;
  font-family: monospace;
  background: white;
  margin-bottom: 8px;
}

.save-option button {
  background: #3b82f6;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.save-option button:hover {
  background: #2563eb;
}

.close-modal {
  background: #6b7280;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  float: right;
  margin-top: 16px;
}

.close-modal:hover {
  background: #4b5563;
}

/* === 保有英傑管理UI === */
.collection-tools {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  padding: 12px;
  margin: 12px 0;
  font-size: 14px;
}

.collection-tools h4 {
  font-size: 16px;
  font-weight: 600;
  color: #0c4a6e;
  margin-bottom: 8px;
}

.collection-summary {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 12px;
}

.summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.summary-number {
  font-size: 18px;
  font-weight: 700;
  color: #0c4a6e;
}

.summary-label {
  font-size: 12px;
  color: #6b7280;
}

.collection-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-button {
  background: white;
  border: 1px solid #bae6fd;
  color: #0c4a6e;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.action-button:hover {
  background: #f0f9ff;
}

.action-button.primary {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.action-button.primary:hover {
  background: #2563eb;
}

/* === レスポンシブ対応 === */
@media (max-width: 768px) {
  .save-modal .modal-content {
    padding: 16px;
    margin: 20px;
  }

  .save-modal h3 {
    font-size: 16px;
  }

  .save-modal h4 {
    font-size: 14px;
  }

  .collection-summary {
    flex-direction: column;
    gap: 8px;
  }

  .collection-actions {
    justify-content: center;
  }
}

/* === アクセシビリティ対応 === */
@media (prefers-reduced-motion: reduce) {
  .ownership-mark,
  .action-button {
    transition: none;
  }
}

/* === 高コントラスト対応 === */
@media (prefers-contrast: high), (forced-colors: active) {
  .owned-eiketsu {
    border-width: 2px;
  }

  .ownership-mark {
    border: 2px solid white;
  }

  .collection-tools {
    border-width: 2px;
  }
}

/* 保有英傑の視覚的フィードバック */
.eiketsu-table tbody tr.owned-eiketsu {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%) !important;
  border-left: 4px solid #0ea5e9 !important;
  font-weight: 500;
}

.eiketsu-table tbody tr.owned-eiketsu:hover {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%) !important;
  transform: translateX(2px);
  transition: all 0.2s ease;
}

.eiketsu-table tbody tr.owned-eiketsu {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%) !important;
  border-left: 4px solid #0ea5e9 !important;
  font-weight: 500;
  position: relative; /* ← 追加: ✓マーク表示のため */
}

.eiketsu-table tbody tr.owned-eiketsu::after {
  content: "✓";
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: #0ea5e9;
  font-weight: bold;
  font-size: 16px;
  z-index: 1; /* ← 追加: 他の要素より前面に */
}

/* Shift+クリック時のフィードバック */
.eiketsu-table tbody tr.shift-clicked {
  animation: ownedToggle 0.3s ease-out;
}

@keyframes ownedToggle {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
    background-color: #3b82f6;
    color: white;
  }
  100% {
    transform: scale(1);
  }
}

.collection-manager-container {
  background: var(--color-bg-card);
  color: var(--color-text-main);
  border: 1px solid var(--color-border);
}

.collection-manager-header {
  background: var(--color-bg);
  color: var(--color-text-main);
  border-bottom: 1px solid var(--color-border);
}

.collection-manager-btn {
  background: var(--color-accent-blue);
  color: #fff;
  border-radius: 4px;
  border: none;
  transition: background 0.2s;
}
.collection-manager-btn:hover {
  background: var(--color-accent-purple);
}

.collection-manager-btn.danger {
  background: var(--color-accent-red);
}

.collection-manager-btn.success {
  background: var(--color-accent-green);
}

.collection-manager-btn:disabled {
  background: var(--color-gray-light);
  color: var(--color-gray);
}

.collection-manager-table th {
  background: var(--color-bg-card);
  color: var(--color-text-sub);
  border-bottom: 1px solid var(--color-border);
}
.collection-manager-table td {
  color: var(--color-text-main);
}

/* 候補英傑詳細モーダル */
.candidate-detail-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 8px;
}
.candidate-detail-modal .modal-body {
  padding: 16px 0 0 0;
}
.eiketsu-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  margin-bottom: 12px;
}
.eiketsu-inen-list {
  margin-bottom: 12px;
}
.eiketsu-inen-list ul {
  margin: 4px 0 0 16px;
  padding: 0;
  font-size: 14px;
}
.eiketsu-desc {
  font-size: 13px;
  color: var(--color-gray);
  margin-bottom: 8px;
}
.candidate-detail-modal .modal-actions {
  margin-top: 16px;
  text-align: right;
}

/* 候補リストの色分け・バッジ・余白調整 */
.candidate-item {
  margin-bottom: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
}
.candidate-item.perfect {
  border-color: var(--color-accent-red);
}
.candidate-item.strong {
  border-color: var(--color-accent-blue);
}
.candidate-item.moderate {
  border-color: var(--color-accent-green);
}
.candidate-item.weak {
  border-color: var(--color-gray);
}
.candidate-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
}
.candidate-name {
  font-size: 16px;
  color: var(--color-text-main);
}
.candidate-job {
  font-size: 13px;
  color: var(--color-gray);
}
.compatibility-score {
  font-size: 13px;
  color: var(--color-accent-blue);
  margin-left: auto;
}
.candidate-details {
  font-size: 12px;
  color: var(--color-gray);
  margin-top: 2px;
}
.shared-inen {
  background: var(--color-accent-blue);
  color: #fff;
  border-radius: 3px;
  padding: 1px 6px;
  margin-right: 4px;
  font-size: 12px;
}
.candidate-item:hover {
  background: var(--color-accent-blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.candidate-item:hover .candidate-name,
.candidate-item:hover .candidate-job,
.candidate-item:hover .compatibility-score {
  color: #fff;
}

/* --- スマホ対応・レスポンシブ --- */
@media (max-width: 600px) {
  .candidate-item {
    padding: 10px 6px;
    font-size: 15px;
  }
  .candidate-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .candidate-name {
    font-size: 15px;
  }
  .candidate-job,
  .compatibility-score {
    font-size: 12px;
  }
  .candidate-detail-modal .modal-body,
  .modal-body {
    padding: 8px 0 0 0;
  }
  .eiketsu-detail-grid {
    grid-template-columns: 1fr;
    gap: 6px 0;
  }
}

/* --- タップUI最適化 --- */
.candidate-item {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.08);
}
.candidate-item:active {
  background: var(--color-accent-blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* --- アニメーション --- */
.candidate-item,
.candidate-detail-modal {
  transition: background 0.2s, color 0.2s, box-shadow 0.2s, transform 0.18s;
}
.candidate-item.result-appear {
  animation: candidateAppear 0.4s ease;
}
@keyframes candidateAppear {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}
.candidate-detail-modal {
  animation: modalAppear 0.32s cubic-bezier(0.4, 1.4, 0.6, 1);
}
@keyframes modalAppear {
  0% {
    opacity: 0;
    transform: scale(0.92);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

/* --- モーダルの最大幅調整 --- */
.candidate-detail-modal .modal-body {
  max-width: 95vw;
  box-sizing: border-box;
}

/* 因縁詳細モーダル */
.inen-detail-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 8px;
}
.inen-detail-modal .modal-body {
  padding: 16px 0 0 0;
  font-size: 15px;
  line-height: 1.7;
}
@media (max-width: 600px) {
  .inen-detail-modal .modal-body {
    padding: 8px 0 0 0;
    font-size: 14px;
  }
}

.ai-reason,
.ai-reason-detail {
  margin-top: 4px;
  font-size: 13px;
  color: var(--color-accent-purple);
  background: var(--color-bg-card);
  border-left: 3px solid var(--color-accent-purple);
  padding: 3px 8px;
  border-radius: 3px;
  line-height: 1.6;
}
.ai-reason-text {
  font-weight: 500;
  letter-spacing: 0.01em;
}
@media (max-width: 600px) {
  .ai-reason,
  .ai-reason-detail {
    font-size: 12px;
    padding: 2px 5px;
  }
}

/* 英傑リスト行のテキスト選択防止（Shift+クリック時） */
.eiketsu-table tr.clickable,
.eiketsu-table tr.selected {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* AIおすすめ組み合わせ（陣形エリア下）カード型デザイン */
#ai-assist-section {
  background: var(--color-bg-card, #f8fafc);
  border: 1.5px solid var(--color-accent-blue, #2563eb);
  border-radius: 12px;
  box-shadow: 0 2px 12px 0 rgba(30, 64, 175, 0.08);
  margin-top: 18px;
  margin-bottom: 12px;
  padding: 20px 18px 18px 18px;
  max-width: 100%;
}
#ai-assist-section .ai-assist-header {
  font-weight: bold;
  font-size: 1.18em;
  color: var(--color-accent-blue, #2563eb);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}
#ai-assist-section .ai-assist-desc {
  color: var(--color-gray, #64748b);
  font-size: 14px;
  margin-bottom: 12px;
  background: var(--color-bg, #fff);
  border-left: 4px solid var(--color-accent-blue, #2563eb);
  padding: 8px 12px;
  border-radius: 6px;
}
#ai-assist-section .ai-assist-placeholder {
  color: var(--color-gray, #64748b);
  font-size: 14px;
  margin-top: 8px;
}
#ai-assist-section .candidate-group {
  margin-bottom: 10px;
  background: var(--color-bg, #fff);
  border-radius: 6px;
  border: 1px solid var(--color-border, #e5e7eb);
  box-shadow: 0 1px 4px 0 rgba(30, 64, 175, 0.04);
  padding: 8px 10px;
}
#ai-assist-section .group-header {
  font-weight: 600;
  color: var(--color-accent-blue, #2563eb);
  font-size: 1em;
  margin-bottom: 4px;
}
#ai-assist-section .ai-candidate-item {
  margin-bottom: 6px;
  padding: 7px 10px;
  border-radius: 4px;
  background: var(--color-bg-card, #f8fafc);
  border: 1px solid var(--color-border, #e5e7eb);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}
#ai-assist-section .ai-candidate-item:hover {
  background: var(--color-accent-blue, #2563eb);
  color: #fff;
}
#ai-assist-section .ai-candidate-item span {
  font-size: 14px;
}
#ai-assist-section .ai-candidate-item .group-title {
  font-weight: 600;
}

/* AIアシスト候補カードを候補因縁デザインに統一 */
.ai-candidate-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-start;
}
.ai-candidate-card {
  margin-bottom: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--color-bg-card, #f9fafb);
  border: 1.5px solid var(--color-border, #e5e7eb);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  min-width: 220px;
  max-width: 320px;
  flex: 1 1 220px;
  cursor: pointer;
  transition: background 0.18s, border 0.18s, box-shadow 0.18s, transform 0.18s;
  position: relative;
}
.ai-candidate-card:hover {
  background: var(--color-accent-blue, #2563eb);
  color: #fff;
  border: 1.5px solid var(--color-accent-blue, #2563eb);
  box-shadow: 0 4px 16px rgba(30, 64, 175, 0.13);
  transform: translateY(-1px) scale(1.01);
}
.ai-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
  margin-bottom: 4px;
}
.ai-card-eiketsu-name {
  font-size: 15px;
  color: var(--color-text-main, #1f2937);
}
.ai-card-owned-badge {
  background: var(--color-accent-green, #10b981);
  color: #fff;
  font-size: 12px;
  border-radius: 6px;
  padding: 2px 8px;
  margin-left: 4px;
  font-weight: 600;
}
.ai-card-row {
  font-size: 12px;
  color: var(--color-gray, #6b7280);
  display: flex;
  gap: 14px;
  margin-bottom: 2px;
}
.ai-card-inens {
  margin-top: 4px;
  font-size: 12px;
  color: var(--color-accent-blue, #2563eb);
  word-break: break-all;
}
.inen-link {
  color: var(--color-accent-blue, #2563eb);
  text-decoration: underline;
  margin-right: 4px;
  cursor: pointer;
  font-weight: 500;
}

/* 陣形エリアの英傑×ボタン小型化・下配置 */
.selected-slot .slot-remove-btn {
  position: absolute !important;
  bottom: -8px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  min-height: 20px !important;
  font-size: 14px !important;
  line-height: 1 !important;
  background: #ef4444 !important;
  color: #fff !important;
  border-radius: 50% !important;
  border: 2px solid #fff !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
  z-index: 15 !important;
  padding: 0 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}
.selected-slot .slot-remove-btn:hover {
  background: #dc2626 !important;
  transform: translateX(-50%) scale(1.1) !important;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3) !important;
}
.selected-slot .slot-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}
.selected-slot .slot-eiketsu-name {
  margin-bottom: 2px;
}

/* --- compatibility-analysis.css --- */
/**
 * 相性分析システム - 専用スタイル
 * 
 * 【適用範囲】
 * - 軸英傑ベース相性分析結果
 * - 段階的候補表示
 * - 相性スコア表示
 */

/* === 放浪娘カラースキーム === */
:root {
  --color-bg: #ffffff;
  --color-bg-card: #f9fafb;
  --color-border: #e5e7eb;
  --color-text-main: #333b4f;
  --color-text-sub: #374151;
  --color-accent-red: #e74c3c;
  --color-accent-blue: #3498db;
  --color-accent-green: #2ecc71;
  --color-accent-purple: #9b59b6;
  --color-accent-orange: #f39c12;
  --color-gray: #6b7280;
  --color-gray-light: #f3f4f6;
  --color-table-stripe: #f5f5f5;
}

/* === 相性分析全体 === */
.compatibility-analysis {
  font-size: 14px;
  color: var(--color-text-main);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 12px;
  margin: 12px 0;
}

.analysis-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-accent-blue);
  margin-bottom: 12px;
}

/* === 相性グループ（段階的表示） === */
.candidate-group {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  margin-bottom: 8px;
  overflow: hidden;
  background: var(--color-bg);
}

.group-header {
  padding: 8px 12px;
  background: var(--color-bg-card);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  border: none;
  width: 100%;
  text-align: left;
  outline: none;
  color: var(--color-text-main);
}

.group-header:hover {
  background: #e5e7eb;
}

.group-header:focus {
  background: #e5e7eb;
  box-shadow: 0 0 0 2px #3b82f6;
}

.group-title {
  font-weight: 500;
  color: var(--color-accent-purple);
}

.group-description {
  font-size: 12px;
  color: var(--color-text-sub);
}

.group-content {
  padding: 12px;
  background: white;
  border-top: 1px solid #e5e7eb;
}

/* === 候補アイテム === */
.candidate-item {
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.candidate-item:hover {
  border-color: #3b82f6;
  background: #f0f9ff;
}

.candidate-item:focus {
  outline: none;
  border-color: #3b82f6;
  background: #f0f9ff;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* === 相性レベル別スタイル === */
.candidate-item.perfect {
  border-left: 3px solid #10b981;
  background: #f0fdf4;
}

.candidate-item.perfect:hover {
  background: #dcfce7;
}

.candidate-item.strong {
  border-left: 3px solid #3b82f6;
  background: #f0f9ff;
}

.candidate-item.strong:hover {
  background: #dbeafe;
}

.candidate-item.moderate {
  border-left: 3px solid #f59e0b;
  background: #fffbeb;
}

.candidate-item.moderate:hover {
  background: #fef3c7;
}

.candidate-item.weak {
  border-left: 3px solid #6b7280;
  background: #f9fafb;
}

.candidate-item.weak:hover {
  background: #f3f4f6;
}

/* === 候補詳細 === */
.candidate-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.candidate-name {
  font-weight: 500;
  color: #1f2937;
  font-size: 14px;
}

.candidate-job {
  font-size: 12px;
  color: #6b7280;
  font-style: italic;
}

.compatibility-score {
  font-size: 12px;
  font-weight: 600;
  color: #3b82f6;
  background: #dbeafe;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 32px;
  text-align: center;
}

.candidate-details {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* === 共通因縁表示 === */
.shared-inen {
  background: #fef3c7;
  color: #92400e;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 10px;
  cursor: help;
  transition: background 0.2s;
}

.shared-inen:hover {
  background: #fde68a;
}

/* === 相性表示のバリエーション === */
.compatibility-score.perfect {
  background: #d1fae5;
  color: #065f46;
}

.compatibility-score.strong {
  background: #dbeafe;
  color: #1e40af;
}

.compatibility-score.moderate {
  background: #fef3c7;
  color: #92400e;
}

.compatibility-score.weak {
  background: #f3f4f6;
  color: #6b7280;
}

/* === 空状態 === */
.no-compatibility-results {
  text-align: center;
  color: #6b7280;
  font-style: italic;
  padding: 20px;
  background: #f9fafb;
  border: 1px dashed #e5e7eb;
  border-radius: 6px;
}

/* === 相性ヒント（トースト用） === */
.compatibility-hint {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 4px;
  display: inline-block;
  margin: 4px 0;
}

/* === 折りたたみ詳細 === */
.candidate-group[open] .group-header {
  background: #e5e7eb;
}

.candidate-group summary::marker {
  content: "";
}

.candidate-group summary::-webkit-details-marker {
  display: none;
}

.group-header::after {
  content: "▼";
  font-size: 10px;
  color: #6b7280;
  transition: transform 0.2s;
}

.candidate-group[open] .group-header::after {
  transform: rotate(180deg);
}

.candidate-group[open] {
  box-shadow: 0 2px 8px 0 rgba(51, 59, 79, 0.08);
}

/* === レスポンシブ対応 === */
@media (max-width: 768px) {
  .candidate-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .compatibility-score {
    align-self: flex-end;
  }

  .candidate-details {
    width: 100%;
    justify-content: flex-start;
  }

  .collection-summary {
    flex-direction: column;
    gap: 8px;
  }
}

/* === アクセシビリティ対応 === */
@media (prefers-reduced-motion: reduce) {
  .candidate-item,
  .group-header::after {
    transition: none;
  }
}

/* === 高コントラスト対応 === */
@media (prefers-contrast: high), (forced-colors: active) {
  .candidate-item.perfect {
    border-left-width: 4px;
  }

  .candidate-item.strong {
    border-left-width: 4px;
  }

  .candidate-item.moderate {
    border-left-width: 4px;
  }

  .candidate-item.weak {
    border-left-width: 4px;
  }

  .compatibility-analysis {
    border-width: 2px;
  }
}

/* === 印刷対応 === */
@media print {
  .compatibility-analysis {
    border: 1px solid #000;
    background: white;
    break-inside: avoid;
  }

  .candidate-item {
    border: 1px solid #000;
    background: white;
  }

  .candidate-item.perfect {
    border-left: 3px solid #000;
  }
}

/* --- modal-components.css --- */
/**
 * モーダル・UIコンポーネント - 専用スタイル
 * 
 * 【適用範囲】
 * - 置き換え提案モーダル
 * - トーストメッセージ
 * - 分析中インジケーター
 * - プログレスバー
 */

/* === 放浪娘カラースキーム === */
:root {
  --color-bg: #ffffff;
  --color-bg-card: #f9fafb;
  --color-border: #e5e7eb;
  --color-text-main: #333b4f;
  --color-text-sub: #374151;
  --color-accent-red: #e74c3c;
  --color-accent-blue: #3498db;
  --color-accent-green: #2ecc71;
  --color-accent-purple: #9b59b6;
  --color-accent-orange: #f39c12;
  --color-gray: #6b7280;
  --color-gray-light: #f3f4f6;
  --color-table-stripe: #f5f5f5;
}

/* === モーダル基盤 === */
.modal,
.ai-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  transition: opacity 0.3s;
}

.modal.modal-active,
.ai-modal.modal-active,
.modal.show,
.ai-modal.show {
  display: flex;
  opacity: 1;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.modal-content {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  margin: auto;
  z-index: 10000;
  background: var(--color-bg-card);
  color: var(--color-text-main);
  border-radius: 8px;
  box-shadow: 0 2px 8px 0 rgba(51, 59, 79, 0.08);
  max-width: 900px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

/* === 置き換え提案モーダル === */
.replacement-modal .modal-content {
  padding: 0;
}

.modal-header {
  padding: 16px 20px;
  background: var(--color-bg);
  color: var(--color-text-main);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--color-accent-red);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
}

.modal-close:hover {
  color: #374151;
  background: #f3f4f6;
}

.modal-body {
  padding: 20px;
}

/* === 置き換えサマリー === */
.replacement-summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px;
  background: #f9fafb;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
}

.current-state,
.improved-state {
  text-align: center;
  min-width: 80px;
}

.current-state .label,
.improved-state .label {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
  font-weight: 500;
}

.current-state .value {
  font-size: 18px;
  font-weight: 700;
  color: #ef4444;
}

.improved-state .value {
  font-size: 18px;
  font-weight: 700;
  color: #10b981;
}

.replacement-summary .arrow {
  font-size: 16px;
  color: #6b7280;
  font-weight: bold;
}

/* === 置き換え詳細 === */
.replacement-detail {
  margin-bottom: 16px;
}

.replacement-text {
  font-size: 16px;
  text-align: center;
  margin-bottom: 8px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 6px;
}

.replacement-text .original {
  color: #ef4444;
  text-decoration: line-through;
  font-weight: 500;
}

.replacement-text .suggested,
.replacement-text .addition {
  color: #10b981;
  font-weight: 600;
}

.replacement-text .arrow {
  margin: 0 8px;
  color: #6b7280;
}

.reason-text {
  text-align: center;
  color: #6b7280;
  font-size: 14px;
  margin-bottom: 12px;
  font-style: italic;
}

/* === 追加効果 === */
.additional-benefits {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
}

.benefit-tag {
  background: #dbeafe;
  color: #1e40af;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  border: 1px solid #93c5fd;
}

/* === 信頼度インジケーター === */
.confidence-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: #f0fdf4;
  border-radius: 6px;
  margin-bottom: 16px;
  border: 1px solid #bbf7d0;
}

.confidence-label {
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
}

.confidence-value {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  min-width: 40px;
}

.confidence-bar {
  flex: 1;
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  background: linear-gradient(90deg, #fbbf24, #10b981);
  transition: width 0.3s ease;
}

/* === モーダルフッター === */
.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: #f9fafb;
}

.btn-cancel,
.btn-apply {
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-weight: 500;
}

.btn-cancel {
  background: var(--color-accent-red);
  color: #fff;
}

.btn-cancel:hover {
  background: #e5e7eb;
  color: #374151;
}

.btn-apply {
  background: var(--color-accent-green);
  color: #fff;
}

.btn-apply:hover {
  background: #2563eb;
}

.btn-apply:active {
  background: #1d4ed8;
}

/* === 分析中インジケーター === */
.analyzing-indicator {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  color: #6b7280;
}

.analyzing-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.analyzing-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #e5e7eb;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.analyzing-text {
  font-size: 14px;
  font-weight: 500;
}

/* === プログレスバー === */
.ai-progress-bar {
  margin: 8px 0;
}

.progress-label {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
  font-weight: 500;
}

.progress-track {
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 4px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 11px;
  color: #6b7280;
  text-align: right;
  font-weight: 500;
}

/* === トーストメッセージ === */
.ai-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  max-width: 320px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
}

.ai-toast.toast-visible {
  opacity: 1;
  transform: translateX(0);
}

.ai-toast-info {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.ai-toast-success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.ai-toast-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fbbf24;
}

.ai-toast-error {
  background: #fecaca;
  color: #991b1b;
  border: 1px solid #f87171;
}

/* === 統計サマリー === */
.stats-summary {
  padding: 12px;
  background: #f9fafb;
  border-radius: 6px;
  margin: 8px 0;
  border: 1px solid #e5e7eb;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 12px;
}

.stats-item {
  text-align: center;
}

.stats-value {
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
}

.stats-label {
  font-size: 11px;
  color: #6b7280;
  margin-top: 2px;
  font-weight: 500;
}

/* === 結果アニメーション === */
.result-appear {
  animation: gentle-fade-in 0.4s ease-out;
}

@keyframes gentle-fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === レスポンシブ対応 === */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    margin: 10px;
    max-height: 90vh;
  }

  .replacement-summary {
    flex-direction: column;
    gap: 8px;
  }

  .replacement-summary .arrow {
    transform: rotate(90deg);
  }

  .ai-toast {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }

  .modal-footer {
    flex-direction: column-reverse;
  }

  .btn-cancel,
  .btn-apply {
    width: 100%;
  }

  .modal-header {
    padding: 12px 16px;
  }

  .modal-body {
    padding: 16px;
  }
}

/* === アクセシビリティ対応 === */
.modal-content:focus-within {
  outline: none;
}

.ai-modal[aria-hidden="true"] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .ai-modal,
  .ai-toast,
  .result-appear,
  .analyzing-spinner,
  .progress-fill,
  .confidence-fill {
    animation: none;
    transition: none;
  }
}

/* === 高コントラスト対応 === */
@media (prefers-contrast: high), (forced-colors: active) {
  .modal-content {
    border: 2px solid #000;
  }

  .btn-cancel,
  .btn-apply {
    border: 2px solid currentColor;
  }

  .confidence-bar,
  .progress-track {
    border: 1px solid #000;
  }
}

/* === 印刷対応 === */
@media print {
  .ai-modal,
  .ai-toast {
    display: none;
  }
}

/* --- opportunity-finder.css --- */
/**
 * 追加因縁分析システム - 専用スタイル
 * 
 * 【適用範囲】
 * - 完成間近因縁の表示
 * - 候補英傑の提案
 * - 優先度別分類表示
 */

/* === 放浪娘カラースキーム === */
:root {
  --color-bg: #ffffff;
  --color-bg-card: #f9fafb;
  --color-border: #e5e7eb;
  --color-text-main: #333b4f;
  --color-text-sub: #374151;
  --color-accent-red: #e74c3c;
  --color-accent-blue: #3498db;
  --color-accent-green: #2ecc71;
  --color-accent-purple: #9b59b6;
  --color-accent-orange: #f39c12;
  --color-gray: #6b7280;
  --color-gray-light: #f3f4f6;
  --color-table-stripe: #f5f5f5;
}

/* === 追加因縁機会全体 === */
.immediate-opportunities {
  font-size: 14px;
  background: #fefce8;
  border: 1px solid #fde047;
  border-radius: 6px;
  padding: 12px;
  margin: 12px 0;
}

.opportunities-title {
  font-size: 16px;
  font-weight: 600;
  color: #a16207;
  margin-bottom: 8px;
}

/* === 空状態 === */
.no-opportunities {
  text-align: center;
  color: #6b7280;
  font-style: italic;
  padding: 16px;
  background: #f9fafb;
  border: 1px dashed #e5e7eb;
  border-radius: 6px;
  margin: 8px 0;
}

/* === 機会リスト === */
.opportunity-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* === 機会アイテム === */
.opportunity-item {
  background: white;
  border: 1px solid #fbbf24;
  border-radius: 4px;
  padding: 8px;
  transition: all 0.2s ease;
}

.opportunity-item:hover {
  background: #fffbeb;
  border-color: #f59e0b;
}

/* === 優先度別スタイル === */
.opportunity-item.high-priority {
  border-left: 3px solid #10b981;
  background: #f0fdf4;
}

.opportunity-item.high-priority:hover {
  background: #dcfce7;
}

.opportunity-item.medium-priority {
  border-left: 3px solid #f59e0b;
  background: #fffbeb;
}

.opportunity-item.medium-priority:hover {
  background: #fef3c7;
}

.opportunity-item.low-priority {
  border-left: 3px solid #6b7280;
  background: #f9fafb;
}

.opportunity-item.low-priority:hover {
  background: #f3f4f6;
}

/* === 機会ヘッダー === */
.opportunity-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--color-bg);
  color: var(--color-text-main);
  border-bottom: 1px solid var(--color-border);
}

.opportunity-title {
  font-size: 12px;
  font-weight: 500;
  color: #d97706;
}

.inen-name {
  font-size: 13px;
  font-weight: 600;
  color: #92400e;
}

/* === 優先度バッジ === */
.priority-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 500;
}

.priority-badge.high {
  background: #d1fae5;
  color: #065f46;
}

.priority-badge.medium {
  background: #fef3c7;
  color: #92400e;
}

.priority-badge.low {
  background: #f3f4f6;
  color: #6b7280;
}

/* === 機会詳細 === */
.opportunity-detail {
  font-size: 11px;
  color: #a16207;
}

.missing-factor {
  display: block;
  margin-bottom: 4px;
  font-style: italic;
}

/* === 候補英傑提案 === */
.candidate-suggestions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.candidate {
  background: #fef3c7;
  color: #92400e;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.candidate:hover {
  background: #fde68a;
  border-color: #f59e0b;
  transform: translateY(-1px);
}

.candidate:active {
  transform: translateY(0);
}

.candidate:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* === 難易度表示 === */
.difficulty-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #6b7280;
  margin-left: 8px;
}

.difficulty-easy {
  color: #10b981;
}

.difficulty-medium {
  color: #f59e0b;
}

.difficulty-hard {
  color: #ef4444;
}

/* === 期待効果表示 === */
.expected-benefit {
  font-size: 11px;
  color: #059669;
  margin-top: 4px;
  font-weight: 500;
}

.benefit-value {
  font-weight: 600;
  color: #047857;
}

/* === コンパクト表示モード === */
.opportunity-item.compact {
  padding: 6px;
}

.opportunity-item.compact .opportunity-header {
  margin-bottom: 2px;
}

.opportunity-item.compact .candidate-suggestions {
  margin-top: 2px;
}

/* === インタラクティブ状態 === */
.candidate.selected {
  background: #3b82f6;
  color: white;
}

.candidate.owned {
  background: #d1fae5;
  color: #065f46;
  border-color: #10b981;
}

.candidate.owned::after {
  content: " ✓";
  font-size: 8px;
}

/* === ローディング状態 === */
.opportunity-item.loading {
  opacity: 0.6;
  pointer-events: none;
}

.opportunity-item.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 8px;
  width: 12px;
  height: 12px;
  border: 2px solid #f3f4f6;
  border-top: 2px solid #f59e0b;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* === 成功状態 === */
.opportunity-item.success {
  border-color: #10b981;
  background: #f0fdf4;
}

.opportunity-item.success .opportunity-title {
  color: #065f46;
}

/* === レスポンシブ対応 === */
@media (max-width: 768px) {
  .opportunity-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .priority-badge {
    align-self: flex-end;
  }

  .candidate-suggestions {
    justify-content: center;
    width: 100%;
  }

  .opportunity-item {
    padding: 10px;
  }
}

/* === アクセシビリティ対応 === */
@media (prefers-reduced-motion: reduce) {
  .candidate,
  .opportunity-item,
  .opportunity-item.loading::after {
    animation: none;
    transition: none;
    transform: none;
  }

  .candidate:hover {
    transform: none;
  }
}

/* === 高コントラスト対応 === */
@media (prefers-contrast: high), (forced-colors: active) {
  .opportunity-item.high-priority {
    border-left-width: 4px;
  }

  .opportunity-item.medium-priority {
    border-left-width: 4px;
  }

  .opportunity-item.low-priority {
    border-left-width: 4px;
  }

  .candidate {
    border-width: 2px;
  }

  .immediate-opportunities {
    border-width: 2px;
  }
}

/* === ダークモード対応 === */
@media (prefers-color-scheme: dark) {
  .immediate-opportunities {
    background: #1f2937;
    border-color: #374151;
  }

  .opportunities-title {
    color: #fbbf24;
  }

  .opportunity-item {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
  }

  .candidate {
    background: #4b5563;
    color: #f9fafb;
  }
}

/* === 印刷対応 === */
@media print {
  .immediate-opportunities {
    border: 1px solid #000;
    background: white;
    break-inside: avoid;
  }

  .opportunity-item {
    border: 1px solid #000;
    background: white;
    break-inside: avoid;
  }

  .candidate {
    border: 1px solid #000;
    background: white;
    color: #000;
  }
}

.opportunity-finder-container {
  background: var(--color-bg-card);
  color: var(--color-text-main);
  border: 1px solid var(--color-border);
}

.opportunity-btn {
  background: var(--color-accent-blue);
  color: #fff;
  border-radius: 4px;
  border: none;
  transition: background 0.2s;
}
.opportunity-btn:hover {
  background: var(--color-accent-purple);
}

.opportunity-btn.danger {
  background: var(--color-accent-red);
}

.opportunity-btn.success {
  background: var(--color-accent-green);
}

.opportunity-btn:disabled {
  background: var(--color-gray-light);
  color: var(--color-gray);
}

/* --- toolbar-integration.css --- */
/**
 * ツールバー・統合UI - 専用スタイル
 * 
 * 【適用範囲】
 * - AI機能トグルボタン
 * - 分析結果表示エリア
 * - メッセージトースト
 * - 全体的な統合調整
 */

/* === 放浪娘カラースキーム === */
:root {
  --color-bg: #ffffff;
  --color-bg-card: #f9fafb;
  --color-border: #e5e7eb;
  --color-text-main: #333b4f;
  --color-text-sub: #374151;
  --color-accent-red: #e74c3c;
  --color-accent-blue: #3498db;
  --color-accent-green: #2ecc71;
  --color-accent-purple: #9b59b6;
  --color-accent-orange: #f39c12;
  --color-gray: #6b7280;
  --color-gray-light: #f3f4f6;
  --color-table-stripe: #f5f5f5;
}

/* === AI機能トグル === */
.ai-toggle {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  color: #374151;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.ai-toggle:hover {
  background: #e5e7eb;
  border-color: #9ca3af;
}

.ai-toggle:active {
  background: #d1d5db;
}

.ai-toggle.active {
  background: #dbeafe;
  color: #1e40af;
  border-color: #3b82f6;
}

.ai-toggle.disabled {
  opacity: 0.6;
  background: #fecaca;
  color: #991b1b;
  border-color: #f87171;
  cursor: not-allowed;
}

.ai-toggle.disabled:hover {
  background: #fecaca;
}

/* === 分析結果表示エリア === */
.ai-analysis-results {
  margin: 16px 0;
  padding: 0;
  display: none;
}

.ai-analysis-results.active {
  display: block;
}

.ai-analysis-results.loading {
  opacity: 0.7;
}

/* === メッセージトースト（統合版） === */
.message-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  max-width: 320px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  animation: slide-in 0.3s ease-out;
}

.message-info {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.message-success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.message-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fbbf24;
}

.message-error {
  background: #fecaca;
  color: #991b1b;
  border: 1px solid #f87171;
}

.message-toast.fade-out {
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease-out;
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* === ツールバー拡張領域 === */
.toolbar-ai-section {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.toolbar-separator {
  width: 1px;
  height: 20px;
  background: #d1d5db;
  margin: 0 8px;
}

/* === 状態インジケーター === */
.ai-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #6b7280;
  padding: 2px 6px;
  border-radius: 10px;
  background: #f3f4f6;
}

.ai-status-indicator.active {
  background: #d1fae5;
  color: #065f46;
}

.ai-status-indicator.analyzing {
  background: #fef3c7;
  color: #92400e;
}

.ai-status-indicator.error {
  background: #fecaca;
  color: #991b1b;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-dot.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* === 統計表示エリア === */
.ai-stats-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin: 8px 0;
  font-size: 12px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-value {
  font-size: 16px;
  font-weight: 700;
  color: #1f2937;
}

.stat-label {
  color: #6b7280;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* === 分析進捗表示 === */
.analysis-progress-container {
  position: relative;
  margin: 8px 0;
}

.analysis-progress-bar {
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  overflow: hidden;
}

.analysis-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  transition: width 0.3s ease;
  width: 0%;
}

.analysis-progress-text {
  position: absolute;
  top: -20px;
  left: 0;
  font-size: 11px;
  color: #6b7280;
}

/* === クイックアクション === */
.quick-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.quick-action-btn {
  background: none;
  border: 1px solid #d1d5db;
  color: #6b7280;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-action-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

.quick-action-btn:active {
  background: #e5e7eb;
}

.quick-action-btn.primary {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.quick-action-btn.primary:hover {
  background: #2563eb;
}

/* === ヘルプ・情報表示 === */
.ai-help-tooltip {
  position: relative;
  display: inline-block;
  cursor: help;
}

.ai-help-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 1000;
}

.ai-help-tooltip:hover::after {
  opacity: 1;
}

/* === エラー表示 === */
.ai-error-message {
  background: #fecaca;
  border: 1px solid #f87171;
  color: #991b1b;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  margin: 8px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.error-icon {
  font-size: 14px;
}

.error-dismiss {
  margin-left: auto;
  background: none;
  border: none;
  color: currentColor;
  cursor: pointer;
  padding: 2px;
}

/* === 成功表示 === */
.ai-success-message {
  background: #d1fae5;
  border: 1px solid #6ee7b7;
  color: #065f46;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  margin: 8px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.success-icon {
  font-size: 14px;
}

/* === レイアウト調整 === */
.ai-enhanced-layout {
  position: relative;
}

.ai-enhanced-layout::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 100%;
  background: linear-gradient(180deg, #3b82f6, #10b981);
  opacity: 0.3;
}

/* === 折りたたみセクション === */
.ai-collapsible-section {
  margin: 8px 0;
}

.ai-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.ai-section-header:hover {
  background: #e5e7eb;
}

.ai-section-content {
  display: none;
  padding: 12px;
  border: 1px solid #d1d5db;
  border-top: none;
  border-radius: 0 0 4px 4px;
  background: white;
}

.ai-collapsible-section.expanded .ai-section-content {
  display: block;
}

.section-toggle {
  transition: transform 0.2s;
}

.ai-collapsible-section.expanded .section-toggle {
  transform: rotate(180deg);
}

/* === レスポンシブ対応 === */
@media (max-width: 768px) {
  .message-toast {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }

  .toolbar-ai-section {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    margin-top: 8px;
  }

  .ai-stats-bar {
    flex-direction: column;
    gap: 8px;
  }

  .quick-actions {
    justify-content: center;
    flex-wrap: wrap;
  }

  .ai-help-tooltip::after {
    position: fixed;
    bottom: 20px;
    left: 50%;
    top: auto;
    white-space: normal;
    max-width: 200px;
  }
}

/* === アクセシビリティ対応 === */
@media (prefers-reduced-motion: reduce) {
  .message-toast,
  .status-dot.pulse,
  .analysis-progress-fill,
  .section-toggle {
    animation: none;
    transition: none;
  }
}

/* === 高コントラスト対応 === */
@media (prefers-contrast: high), (forced-colors: active) {
  .ai-toggle,
  .quick-action-btn,
  .ai-section-header {
    border-width: 2px;
  }

  .ai-enhanced-layout::before {
    opacity: 1;
    width: 3px;
  }
}

/* === 印刷対応 === */
@media print {
  .message-toast,
  .ai-toggle,
  .quick-actions,
  .ai-help-tooltip::after {
    display: none;
  }

  .ai-analysis-results {
    border: 1px solid #000;
    background: white;
  }
}

.toolbar-container {
  background: var(--color-bg-card);
  color: var(--color-text-main);
  border: 1px solid var(--color-border);
}

.toolbar-btn {
  background: var(--color-accent-blue);
  color: #fff;
  border-radius: 4px;
  border: none;
  transition: background 0.2s;
}
.toolbar-btn:hover {
  background: var(--color-accent-purple);
}

.toolbar-btn.danger {
  background: var(--color-accent-red);
}

.toolbar-btn.success {
  background: var(--color-accent-green);
}

.toolbar-btn:disabled {
  background: var(--color-gray-light);
  color: var(--color-gray);
}

/* =====================================================
 * 提案機能強化スタイル
 * ===================================================== */

/* === ランキングバッジ === */
.rank-badge {
  position: absolute;
  top: -8px;
  left: -8px;
  min-width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.rank-badge.rank-1 {
  background: linear-gradient(135deg, #ffd700, #ffb800);
  font-size: 16px;
}

.rank-badge.rank-2 {
  background: linear-gradient(135deg, #c0c0c0, #a0a0a0);
  font-size: 16px;
}

.rank-badge.rank-3 {
  background: linear-gradient(135deg, #cd7f32, #b87333);
  font-size: 16px;
}

.rank-badge.rank-other {
  background: var(--color-gray);
  color: white;
  font-size: 10px;
  font-weight: 700;
}

/* === 保有インジケーター === */
.owned-indicator {
  display: inline-block;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 8px;
  margin-left: 4px;
  font-weight: 600;
  vertical-align: middle;
}

.owned-candidate {
  border: 2px solid #10b981 !important;
  background: linear-gradient(135deg, #f0fdf4, #ecfdf5) !important;
}

.owned-candidate:hover {
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;
}

/* === 2因子貢献表示 === */
.impact-score-compact.contrib {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 4px;
}

/* === ホバープレビュー === */
.inen-card.preview-activation {
  animation: previewPulse 0.8s ease-in-out infinite;
  border: 2px solid #10b981 !important;
  background: linear-gradient(135deg, #ecfdf5, #d1fae5) !important;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
  transform: scale(1.02);
}

.inen-card.preview-contributing {
  border: 2px dashed #8b5cf6 !important;
  background: linear-gradient(135deg, #faf5ff, #f3e8ff) !important;
  opacity: 0.9;
}

@keyframes previewPulse {
  0%,
  100% {
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
  }
  50% {
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.6);
  }
}

/* === コンパクトカード強化 === */
.compact-candidate-card {
  position: relative;
  transition: all 0.2s ease;
}

.compact-candidate-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.compact-candidate-card.medium-impact {
  border-left: 4px solid #10b981;
}

.compact-candidate-card.low-impact {
  border-left: 4px solid #8b5cf6;
}

.impact-display-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

/* === 推奨セクションヘッダー強化 === */
.compact-suggestion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  border-radius: 8px;
  margin-bottom: 12px;
}

.suggestion-title {
  font-size: 15px;
  font-weight: 700;
  color: #0369a1;
}

/* === レスポンシブ対応 === */
@media (max-width: 768px) {
  .rank-badge {
    width: 20px;
    height: 20px;
    font-size: 12px;
    top: -6px;
    left: -6px;
  }

  .owned-indicator {
    font-size: 9px;
    padding: 1px 4px;
  }

  .impact-score-compact.contrib {
    font-size: 10px;
    padding: 1px 6px;
  }
}

/* =====================================================
 * UX改善スタイル
 * ===================================================== */

/* === フローティング共有ボタン === */
.floating-action-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 1000;
}

.floating-action-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.floating-action-btn:active {
  transform: scale(0.95);
}

.floating-action-btn svg {
  width: 24px;
  height: 24px;
}

/* === モバイル用ボトムバー === */
.mobile-bottom-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: 999;
}

.bottom-bar-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.bottom-bar-btn.primary {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.bottom-bar-btn.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-1px);
}

.bottom-bar-btn:disabled {
  background: #e5e7eb;
  color: #9ca3af;
  cursor: not-allowed;
}

.bottom-bar-btn svg {
  width: 20px;
  height: 20px;
}

@media (max-width: 768px) {
  .mobile-bottom-bar {
    display: block;
  }

  /* フローティングボタンを上に移動（ボトムバーと重ならないように） */
  .floating-action-btn {
    bottom: 100px;
    right: 16px;
    width: 48px;
    height: 48px;
  }

  .floating-action-btn svg {
    width: 20px;
    height: 20px;
  }

  /* コンテンツの下部にパディングを追加 */
  body {
    padding-bottom: 80px;
  }
}

/* === ドロップダウンメニュー === */
.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  padding: 8px;
  min-width: 180px;
  z-index: 1000;
  animation: dropdownFadeIn 0.2s ease;
}

.dropdown-menu.hidden {
  display: none;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 4px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #374151;
  text-decoration: none;
  transition: background 0.15s ease;
}

.dropdown-item:hover {
  background: #f3f4f6;
}

.dropdown-item svg {
  width: 18px;
  height: 18px;
  color: #374151;
}

/* === ヘッダー簡素化 === */
.header-actions-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.main-actions .buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.menu-btn {
  padding: 8px !important;
  min-width: auto !important;
}

.menu-btn svg {
  width: 20px;
  height: 20px;
}

.primary-action {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed) !important;
}

.primary-action:hover {
  background: linear-gradient(135deg, #7c3aed, #6d28d9) !important;
}

@media (max-width: 640px) {
  .primary-action span {
    display: none;
  }

  .primary-action {
    padding: 8px !important;
  }
}

/* === ボタン押下時のリップルエフェクト === */
.custom-btn,
.bottom-bar-btn,
.floating-action-btn {
  overflow: hidden;
  position: relative;
}

.custom-btn::after,
.bottom-bar-btn::after,
.floating-action-btn::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.3) 10%,
    transparent 10%
  );
  transform: scale(10);
  opacity: 0;
  transition: transform 0.5s, opacity 0.5s;
  pointer-events: none;
}

.custom-btn:active::after,
.bottom-bar-btn:active::after,
.floating-action-btn:active::after {
  transform: scale(0);
  opacity: 1;
  transition: 0s;
}

/* === 目標因縁セレクター === */
#target-inen-selector summary {
  list-style: none;
}

#target-inen-selector summary::-webkit-details-marker {
  display: none;
}

#target-inen-selector[open] summary {
  border-radius: 8px 8px 0 0;
}

.target-inen-badge {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.target-inen-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #f3f4f6;
  color: #374151;
  border: 2px solid transparent;
}

.target-inen-chip:hover {
  background: #e5e7eb;
}

.target-inen-chip.selected {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
  border-color: #7c3aed;
}

.target-inen-chip.selected::after {
  content: "✓";
  margin-left: 6px;
}

.target-candidate-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #faf5ff;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.target-candidate-item:hover {
  background: #8b5cf6;
  color: white;
}

.target-candidate-item .candidate-factors {
  font-size: 11px;
  color: #6b7280;
}

.target-candidate-item:hover .candidate-factors {
  color: rgba(255, 255, 255, 0.8);
}

.target-candidate-item .owned-mark {
  background: #10b981;
  color: white;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 6px;
  margin-left: 8px;
}

/* === 因縁カードの色分け強化 === */

/* 発動中（緑） */
.inen-card.activatable {
  border-left: 4px solid #10b981;
  background: linear-gradient(to right, #f0fdf4, white);
}

/* あと1体で発動（オレンジ） */
.inen-card[data-missing="1"] {
  border-left: 4px solid #f59e0b;
  background: linear-gradient(to right, #fffbeb, white);
}

/* あと2体で発動（紫） */
.inen-card[data-missing="2"] {
  border-left: 4px solid #8b5cf6;
  background: linear-gradient(to right, #faf5ff, white);
}

/* 発動時のお祝いアニメーション */
.inen-card.just-activated {
  animation: celebrateActivation 0.8s ease-out;
}

@keyframes celebrateActivation {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(16, 185, 129, 0);
  }
  30% {
    transform: scale(1.03);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
    background: #d1fae5;
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* 因縁カードのホバー強化 */
.inen-card {
  transition: all 0.2s ease, transform 0.15s ease;
}

.inen-card:hover {
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* 進捗バー */
.inen-progress {
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}

.inen-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.inen-progress-fill.complete {
  background: linear-gradient(90deg, #10b981, #059669);
}

.inen-progress-fill.partial {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

/* === モーダル候補カード強化 === */
.candidate-card.owned-candidate {
  border: 2px solid #10b981;
  background: linear-gradient(to right, #f0fdf4, white);
}

.candidate-card .owned-badge {
  display: inline-block;
  background: #10b981;
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 8px;
  margin-left: 6px;
  font-weight: 600;
}

.candidate-card .stats-badge {
  background: #6366f1;
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
}

.candidate-card .rank-badge {
  margin-right: 4px;
}

.candidate-name {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* === 代替英傑提案パネル === */
.alternative-panel {
  margin-top: 12px;
  padding: 12px;
  background: linear-gradient(135deg, #e0f2fe, #f0f9ff);
  border: 2px solid #0ea5e9;
  border-radius: 12px;
}

.alternative-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.alternative-icon {
  font-size: 20px;
}

.alternative-title {
  font-weight: 600;
  color: #0369a1;
}

/* =============================================
   折りたたみパネル共通スタイル
   ============================================= */

.collapsible-section {
  border-radius: 12px;
  border: 1px solid #e0f2fe;
  background: #f0f9ff;
  overflow: hidden;
}

.collapsible-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  background: linear-gradient(135deg, #e0f2fe, #f0f9ff);
  transition: background 0.15s ease;
}

.collapsible-header::-webkit-details-marker {
  display: none;
}

.collapsible-header:hover {
  background: linear-gradient(135deg, #bae6fd, #e0f2fe);
}

.collapsible-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.collapsible-title {
  font-weight: 600;
  color: #0369a1;
  font-size: 14px;
}

.optional-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  background: #6b7280;
  color: white;
  border-radius: 10px;
  margin-left: auto;
}

.collapse-arrow {
  font-size: 10px;
  color: #0369a1;
  transition: transform 0.2s ease;
  margin-left: 8px;
}

details[open] .collapse-arrow {
  transform: rotate(180deg);
}

.collapsible-content {
  padding: 12px 14px;
  border-top: 1px solid #bae6fd;
  background: white;
}

.alternative-desc {
  font-size: 11px;
  color: #64748b;
  margin: 0 0 12px 0;
}

.alternative-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alternative-slot {
  background: white;
  border-radius: 8px;
  padding: 10px;
  border: 1px solid #e0e7ff;
}

.alternative-slot-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e5e7eb;
}

.alt-slot-number {
  background: #6366f1;
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  position: static;
}

.slot-eiketsu-name {
  font-weight: 600;
  color: #374151;
}

.slot-factor-info {
  font-size: 10px;
  color: #6b7280;
  margin-left: auto;
}

.alternative-candidates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.alt-candidate {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 12px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.alt-candidate:hover {
  background: #0ea5e9;
  color: white;
  border-color: #0ea5e9;
}

.alt-candidate.owned {
  background: #d1fae5;
  border-color: #10b981;
}

.alt-candidate.owned:hover {
  background: #10b981;
}

.alt-candidate.full-match {
  border-color: #22c55e;
  border-width: 2px;
}

.alt-candidate.partial-match {
  border-color: #f59e0b;
  border-style: dashed;
}

.alt-candidate .owned-mark {
  font-size: 10px;
  color: #10b981;
}

.alt-candidate:hover .owned-mark {
  color: white;
}

.alt-candidate .alt-name {
  font-weight: 500;
}

/* マッチラベル */
.match-label {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  margin-right: 4px;
}

.match-label.full {
  background: #22c55e;
  color: white;
}

.match-label.partial {
  background: #f59e0b;
  color: white;
}

/* 凡例 */
.alternative-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px 12px;
  background: #f1f5f9;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 11px;
  color: #64748b;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.owned-example {
  display: inline-block;
  padding: 2px 6px;
  border: 2px solid #10b981;
  border-radius: 6px;
  background: #d1fae5;
  font-size: 10px;
  color: #10b981;
}

.no-alternatives {
  font-size: 11px;
  color: #9ca3af;
  font-style: italic;
}

/* =============================================
   モバイル ファーストビュー最適化
   ============================================= */

/* フィルター2カラム表示（タブレット以下） */
@media (max-width: 1024px) {
  /* モバイル用フィルターグリッド - 2カラム表示 */
  .mobile-filter-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  /* キーワード検索は1カラム幅で上に */
  .mobile-filter-grid .keyword-col {
    grid-column: 1 / -1 !important;
  }

  /* 表示フィルターと因縁絞り込みは横並び */
  .mobile-filter-grid .filter-col {
    grid-column: span 1 !important;
  }
}

@media (max-width: 768px) {
  /* ハンバーガーメニューだけを右上に固定 */
  .menu-btn {
    position: fixed !important;
    top: 8px !important;
    right: 8px !important;
    z-index: 1000 !important;
    background: #374151 !important;
    color: white !important;
    border-radius: 50% !important;
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  }

  /* ドロップダウンメニューも固定位置に */
  .dropdown-menu {
    position: fixed !important;
    top: 56px !important;
    right: 8px !important;
    z-index: 999 !important;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px;
    min-width: 180px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
  }

  .dropdown-menu.hidden {
    display: none !important;
  }

  /* ヘッダーは非表示（シンプル化） */
  .dropdown-header {
    display: none;
  }

  .dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 6px 0;
  }

  .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    width: 100%;
    border: none;
    background: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    transition: background 0.15s ease;
  }

  .dropdown-item:hover {
    background: #f3f4f6;
  }

  .dropdown-item svg {
    width: 18px;
    height: 18px;
    color: #9ca3af;
    flex-shrink: 0;
  }

  /* 特集アイテムも控えめに */
  .dropdown-item.featured {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
  }

  .dropdown-item.featured:hover {
    background: #f1f5f9;
  }

  .dropdown-item.featured svg {
    color: #64748b;
  }

  .dropdown-item .badge {
    margin-left: auto;
    font-size: 9px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 8px;
    background: #94a3b8;
    color: white;
  }

  .dropdown-item .badge.new {
    background: #94a3b8;
  }

  /* アイテムカウント */
  .item-count {
    margin-left: auto;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 6px;
    background: #f1f5f9;
    color: #94a3b8;
    border-radius: 6px;
  }

  /* モバイルでヘッダー調整 */
  header {
    padding-top: 0 !important;
    text-align: center;
  }

  /* h1のパディングは不要（ハンバーガーは絶対配置のため） */

  /* 英傑探訪設定ボタンをモバイルで表示（ドロップダウンメニュー内に移動済み） */

  /* ヘッダーアクションコンテナ */
  .header-actions-container {
    position: static;
  }

  .main-actions .buttons {
    display: flex;
    gap: 8px;
  }

  /* ヘッダーのpadding調整（右上にハンバーガーがあるので） */
  header.mb-6 {
    padding-right: 50px !important;
  }
}

/* 小さいスマホ用（375px以下） */
@media (max-width: 375px) {
  .mobile-filter-grid {
    grid-template-columns: 1fr !important;
  }

  .mobile-filter-grid .keyword-col,
  .mobile-filter-grid .filter-col {
    grid-column: 1;
  }
}

/* =============================================
   詳細分析モーダル レイアウト改善
   ============================================= */

/* モーダル全体 */
.candidate-inen-detail {
  padding: 16px;
}

/* セクション共通スタイル強化 */
.candidate-inen-detail .section {
  margin-bottom: 20px;
  padding: 16px;
  background: #f9fafb;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.candidate-inen-detail .section:last-child {
  margin-bottom: 0;
}

/* セクションヘッダー */
.candidate-inen-detail h4 {
  font-size: 15px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e5e7eb;
}

/* 基本情報グリッド強化 */
.candidate-inen-detail .section > div[style*="grid"] {
  background: white;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

/* 因子分析リスト */
.factor-analysis-list {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.factor-analysis-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: 10px;
  border: 2px solid;
  background: white;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.factor-analysis-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.factor-analysis-item.can-provide {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border-color: #22c55e;
}

.factor-analysis-item.need-more {
  background: linear-gradient(135deg, #fef2f2, #fee2e2);
  border-color: #ef4444;
}

.factor-name {
  font-size: 14px;
  font-weight: 700;
  color: #374151;
}

.factor-number {
  font-size: 11px;
  color: #6b7280;
  background: #e5e7eb;
  padding: 2px 8px;
  border-radius: 10px;
}

.provision-status .provider {
  color: #16a34a;
  font-weight: 600;
}

.provision-status .missing {
  color: #dc2626;
  font-weight: 600;
}

/* 現在の英傑リスト */
.current-eiketsu-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.current-eiketsu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: white;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  transition: all 0.15s ease;
  cursor: grab;
}

.current-eiketsu-item:hover {
  background: #f3f4f6;
}

.current-eiketsu-item.contributing {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-color: #3b82f6;
}

/* ドラッグハンドル */
.drag-handle {
  color: #9ca3af;
  font-size: 12px;
  cursor: grab;
  user-select: none;
  margin-right: 4px;
}

.current-eiketsu-item:hover .drag-handle {
  color: #6b7280;
}

/* ドラッグ中 */
.current-eiketsu-item.dragging {
  opacity: 0.5;
  cursor: grabbing;
  background: #e5e7eb;
}

/* ドロップターゲット */
.current-eiketsu-item.drag-over {
  border: 2px dashed #6366f1;
  background: #eef2ff;
}

/* 空きスロット */
.current-eiketsu-item.empty-slot {
  cursor: default;
  border-style: dashed;
}

.current-eiketsu-item .slot-number {
  position: static;
  transform: none;
  background: #6366f1;
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  min-width: 60px;
  text-align: center;
}

.current-eiketsu-item .eiketsu-name {
  font-weight: 600;
  color: #1f2937;
  min-width: 80px;
}

.current-eiketsu-item .factors {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
}

.current-eiketsu-item .factor-tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f3f4f6;
  color: #6b7280;
}

.current-eiketsu-item .factor-tag.providing {
  background: #22c55e;
  color: white;
  font-weight: 600;
}

.current-eiketsu-item .factor-tag.relevant {
  background: #fbbf24;
  color: #78350f;
}

.eiketsu-remove-btn {
  background: #ef4444;
  color: white;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.eiketsu-remove-btn:hover {
  background: #dc2626;
}

/* 推奨英傑セクション */
.modal-candidate-section {
  margin-top: 16px;
  padding: 16px;
  background: linear-gradient(135deg, #faf5ff, #f3e8ff);
  border-radius: 12px;
  border: 2px solid #a855f7;
}

.modal-candidate-section h4 {
  color: #7c3aed;
  margin-bottom: 12px;
}

/* 候補カードグリッド */
.candidate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.candidate-card {
  background: white;
  border-radius: 10px;
  padding: 12px;
  border: 2px solid #e5e7eb;
  cursor: pointer;
  transition: all 0.2s ease;
}

.candidate-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  border-color: #8b5cf6;
}

.candidate-card.high-impact {
  border-color: #22c55e;
  background: linear-gradient(135deg, #f0fdf4, #ffffff);
}

.candidate-card.owned-candidate {
  border-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.candidate-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.candidate-name {
  font-weight: 700;
  font-size: 13px;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.rank-badge {
  font-size: 14px;
}

.owned-badge {
  background: #10b981;
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 8px;
  font-weight: 600;
}

.stats-badge {
  background: #3b82f6;
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 8px;
}

.candidate-meta {
  display: flex;
  gap: 4px;
}

.job-badge,
.cost-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 6px;
  background: #e5e7eb;
  color: #4b5563;
}

.factor-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.factor-chip {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f3f4f6;
  color: #6b7280;
}

.factor-chip.providing {
  background: #22c55e;
  color: white;
  font-weight: 600;
}

.impact-info {
  font-size: 11px;
  color: #059669;
  background: #ecfdf5;
  padding: 4px 8px;
  border-radius: 6px;
}

/* 展開ボタン */
.modal-expand-btn {
  width: 100%;
  padding: 10px;
  margin-top: 12px;
  background: #f3f4f6;
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: #6b7280;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.modal-expand-btn:hover {
  background: #e5e7eb;
  border-color: #9ca3af;
}

/* モバイル対応 */
@media (max-width: 640px) {
  .candidate-inen-detail {
    padding: 12px;
  }

  .candidate-inen-detail .section {
    padding: 12px;
  }

  .factor-analysis-list {
    grid-template-columns: 1fr;
  }

  .candidate-grid {
    grid-template-columns: 1fr;
  }

  .current-eiketsu-item {
    flex-wrap: wrap;
  }

  .current-eiketsu-item .factors {
    width: 100%;
    margin-top: 6px;
  }
}

/* =============================================
   コミュニティモーダル レイアウト改善
   ============================================= */

/* モーダル全体 */
.community-modal-content {
  max-width: 800px;
  width: 95%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

/* タブ */
.community-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 8px;
  background: #f9fafb;
  border-radius: 8px;
  margin-bottom: 12px;
}

.tab-btn {
  flex: 1;
  min-width: 70px;
  padding: 10px 12px;
  border: none;
  background: white;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  background: #e5e7eb;
}

.tab-btn.active {
  background: #6366f1;
  color: white;
}

/* カテゴリフィルター */
.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  padding: 0 4px;
}

.category-filter-btn {
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  background: white;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.category-filter-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.category-filter-btn.active {
  background: #10b981;
  color: white;
  border-color: #10b981;
}

/* 編成カードグリッド */
.formation-card-grid {
  display: grid;
  gap: 12px;
}

/* 編成カード */
.formation-card {
  background: white;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  transition: box-shadow 0.15s ease;
}

.formation-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.formation-card-summary {
  padding: 14px;
}

.summary-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.inen-badge {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 16px;
  white-space: nowrap;
  flex-shrink: 0;
}

.formation-title {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
  line-height: 1.4;
  word-break: break-word;
}

.summary-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.author-info {
  font-size: 12px;
  color: #6b7280;
  margin: 0;
}

.submission-date {
  color: #9ca3af;
}

.tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.new-badge {
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.category-tag {
  background: #fef3c7;
  color: #92400e;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

/* 英傑アイコン */
.eiketsu-icons {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.eiketsu-icons span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: #f3f4f6;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  color: #374151;
}

.eiketsu-icons span.empty {
  background: #e5e7eb;
  color: #9ca3af;
}

/* カードフッター */
.summary-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid #e5e7eb;
}

.btn-like {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-like:hover:not(:disabled) {
  background: #fef3c7;
  border-color: #f59e0b;
}

.btn-like.liked {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #b45309;
}

.details-toggle {
  padding: 8px 14px;
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease;
}

.details-toggle:hover {
  background: #f3f4f6;
}

/* 詳細展開 */
.formation-card-details {
  display: none;
  padding: 0 14px 14px;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
}

.formation-card.expanded .formation-card-details {
  display: block;
  padding-top: 14px;
}

.detail-section {
  margin-bottom: 14px;
}

.detail-section:last-child {
  margin-bottom: 0;
}

.detail-section h6 {
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.member-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.member-item {
  background: white;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  font-size: 12px;
}

.inen-list-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.inen-list-tag {
  background: #dbeafe;
  color: #1e40af;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}

.btn-import {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-import:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* ランキング */
.ranking-list {
  background: white;
  border-radius: 12px;
  overflow: hidden;
}

.ranking-header,
.ranking-row {
  display: grid;
  grid-template-columns: 60px 1fr 80px;
  gap: 8px;
  padding: 12px 16px;
  align-items: center;
}

.ranking-header {
  background: #f9fafb;
  font-size: 11px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
}

.ranking-row {
  border-top: 1px solid #e5e7eb;
}

.ranking-row .rank {
  font-size: 18px;
  font-weight: 700;
}

.ranking-row .name {
  font-weight: 600;
}

.ranking-row .count {
  text-align: right;
  color: #6b7280;
}

/* モバイル対応 */
@media (max-width: 640px) {
  .community-modal-content {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
  }

  .community-tabs {
    gap: 4px;
    padding: 6px;
  }

  .tab-btn {
    padding: 8px 8px;
    font-size: 12px;
  }

  .category-filters {
    gap: 4px;
    padding-bottom: 8px;
  }

  .category-filter-btn {
    padding: 5px 10px;
    font-size: 11px;
  }

  .formation-card-summary {
    padding: 12px;
  }

  .summary-header {
    flex-direction: column;
    gap: 6px;
  }

  .inen-badge {
    font-size: 11px;
    padding: 3px 8px;
  }

  .formation-title {
    font-size: 13px;
  }

  .eiketsu-icons span {
    width: 28px;
    height: 28px;
    font-size: 10px;
  }

  .summary-footer {
    flex-direction: column;
    gap: 8px;
  }

  .btn-like,
  .details-toggle {
    width: 100%;
    justify-content: center;
  }

  .ranking-header,
  .ranking-row {
    grid-template-columns: 50px 1fr 60px;
    padding: 10px 12px;
  }
}

/* =============================================
   データ一覧モーダル
   ============================================= */

.data-list-container {
  max-height: 60vh;
  overflow-y: auto;
}

.data-list-summary {
  margin: 0 0 16px;
  padding: 10px 14px;
  background: #f0fdf4;
  border-radius: 8px;
  font-size: 14px;
  color: #166534;
}

.data-list-group {
  margin-bottom: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

.data-list-group summary {
  padding: 12px 14px;
  background: #f9fafb;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  color: #374151;
  list-style: none;
}

.data-list-group summary::-webkit-details-marker {
  display: none;
}

.data-list-group summary::before {
  content: "▶";
  margin-right: 8px;
  font-size: 10px;
  transition: transform 0.15s ease;
  display: inline-block;
}

.data-list-group[open] summary::before {
  transform: rotate(90deg);
}

.data-list-items {
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.data-list-item {
  display: inline-block;
  padding: 4px 10px;
  background: #e5e7eb;
  border-radius: 6px;
  font-size: 12px;
  color: #374151;
}

/* 因子一覧 */
.factor-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.factor-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
}

.factor-name {
  font-size: 13px;
  font-weight: 600;
  color: #0369a1;
}

.factor-holder-count {
  font-size: 11px;
  color: #6b7280;
}

/* 因縁一覧 */
.inen-list-items {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inen-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.inen-name {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
}

.inen-factors {
  font-size: 11px;
  color: #6b7280;
}

/* ドロップダウンのカウントバッジ */
.item-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  background: #e5e7eb;
  color: #6b7280;
  border-radius: 10px;
}

/* =====================================================
 * モバイルレスポンシブ対応
 * =====================================================
 * タッチ操作に最適化されたボタンサイズ、フォントサイズ調整
 */

/* 小型デバイス (640px以下) */
@media (max-width: 640px) {
  /* ボタンサイズの拡大 */
  .custom-btn {
    min-height: 44px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }
  
  /* テーブルコンテナの高さ調整 */
  .table-container {
    max-height: 50vh;
  }
  
  /* テーブルセルのパディング調整 */
  .eiketsu-table th,
  .eiketsu-table td {
    padding: 0.5rem 0.6rem;
    font-size: 12px;
  }
  
  /* 陣形エリアの高さ調整 */
  .selected-eiketsu-container {
    height: 220px;
  }
  
  /* スロットサイズの調整 */
  .selected-slot {
    width: 70px;
    height: 70px;
  }
  
  /* サマリーボックスのサイズ調整 */
  .summary-value {
    font-size: 16px;
  }
  
  .summary-label {
    font-size: 9px;
  }
}

/* 中型デバイス (767px以下) */
@media (max-width: 767px) {
  /* iOSズーム防止 + タッチ対応 */
  input, select, textarea {
    font-size: 16px !important;
    min-height: 44px;
  }
  
  /* 全ボタンのタッチ領域確保 */
  .custom-btn,
  button {
    min-height: 44px;
    touch-action: manipulation;
  }
  
  /* チェックボックスサイズ調整（名前の視認性優先）*/
  input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
  }
  
  /* フィルタードロップダウン */
  .filter-dropdown,
  #keyword-search {
    min-height: 44px;
    font-size: 16px !important;
  }
  
  /* 因縁カードのタップ領域確保 */
  .inen-card {
    padding: 14px;
  }
  
  /* モバイルボトムバーの強調 */
  .mobile-bottom-bar {
    padding: 12px 16px;
  }
  
  .bottom-bar-btn {
    min-height: 48px;
    font-size: 14px;
  }
}

/* タッチデバイス専用スタイル */
@media (hover: none) and (pointer: coarse) {
  .custom-btn {
    min-height: 44px;
    touch-action: manipulation;
  }
  
  input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 2px;
    flex-shrink: 0;
  }
  
  /* テーブル行のタップ領域確保 */
  .eiketsu-table tbody tr td {
    padding: 0.625rem 0.75rem;
  }
  
  /* スロットのタッチ操作改善 */
  .selected-slot {
    touch-action: manipulation;
  }
  
  /* モーダルボタンの拡大 */
  .modal-close {
    width: 44px;
    height: 44px;
    font-size: 24px;
  }
}
