﻿* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html {
    font-size: 14px;
    scroll-behavior: smooth;
}
body {
    font-family: "Inter", sans-serif;
    line-height: 1.5;
    background: var(--color-bg);
    color: var(--color-text-main);
}
::-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: 500px;
    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: 500px;
    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);
}
@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 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 .boosts-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
#total-boosts-display .boost-item {
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#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;
}
#copy-team-button {
    background-color: #10b981;
}
#copy-team-button:hover {
    background-color: #059669;
}
#share-url-btn {
    background-color: #3b82f6;
}
#share-url-btn:hover {
    background-color: #2563eb;
}
.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%;
}
.formation-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.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;
}
.formation-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    width: 100%;
}
.formation-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.formation-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}
@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;
    }
}
