/* party.css */
#party-screen {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#party-screen.hidden {
    display: none;
}

/* 本戦: キャラ1体選択画面 */
#main-char-select-screen {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: #e8eaf6;
    overflow: auto;
}

#main-char-select-screen.hidden {
    display: none;
}

.main-char-select-layout {
    display: flex;
    gap: 24px;
    max-width: 900px;
    width: 100%;
    margin-top: 16px;
}

.main-char-select-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    flex: 1;
}

.main-char-select-grid .character-card {
    cursor: pointer;
    position: relative;
}

.main-char-select-grid .character-card.selected {
    outline: 3px solid #4db6ac;
}

.main-char-select-grid .character-card.taken-by-other {
    pointer-events: none;
    opacity: 0.6;
    cursor: not-allowed;
}

.main-char-select-grid .character-card .char-taken-label {
    position: absolute;
    bottom: 4px;
    left: 4px;
    right: 4px;
    font-size: 0.7em;
    color: #fff;
    background: rgba(0,0,0,0.7);
    padding: 2px 6px;
    border-radius: 4px;
    text-align: center;
}

.main-char-select-others {
    width: 220px;
    padding: 16px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.main-char-select-others h3 {
    margin: 0 0 12px 0;
    font-size: 1em;
    color: #333;
}

#main-char-select-others-list {
    min-height: 80px;
    margin-bottom: 12px;
}

#main-char-select-others-list .other-player-row {
    padding: 6px 0;
    border-bottom: 1px solid #eee;
    font-size: 0.9em;
}

#main-char-select-go-placement {
    width: 100%;
    padding: 10px;
    margin-top: 8px;
}

.party-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background-color: #3f51b5;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-title {
    margin: 0;
    font-size: 1.8em;
}

.header-spacer {
    min-width: 80px;
}

.header-buttons .action-button {
    background-color: #ff9800;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s;
}

.header-buttons .action-button:hover {
    background-color: #fb8c00;
}

.main-content {
    display: flex;
    flex: 1;
    min-height: 0;
    padding: 20px;
    gap: 20px;
    background-color: #e8eaf6;
    overflow: hidden;
}

.character-pane {
    flex: 6;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 15px;
    overflow: hidden;
}

#character-list {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    grid-auto-rows: min-content;
    align-items: start;
    gap: 12px;
    margin: 16px 0;
    overflow-y: auto;
}

.character-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background-color: #f9f9f9;
}

.character-card:hover {
    background-color: #e3f2fd;
    border-color: #2196f3;
    cursor: grab;
}

.character-card[draggable="true"] {
    cursor: grab;
}

.character-card[draggable="true"]:active {
    cursor: grabbing;
}

.character-card.selected {
    border-color: #2196f3;
    box-shadow: 0 0 0 3px #2196f3;
    background-color: #e3f2fd;
}

.char-thumb {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 4px;
}

.char-info h4 {
    margin: 0;
    font-size: 0.9em;
    color: #333;
    line-height: 1.2;
}

.char-info p {
    margin: 0;
    font-size: 0.75em;
    color: #666;
}

.right-pane {
    flex: 2;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow: hidden;
}

#party-slots-container {
    flex-shrink: 0;
    flex-grow: 0;
    min-height: 130px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 15px;
}

.party-slots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 10px;
    margin-top: 10px;
}

.party-slot {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    min-width: 80px;
    min-height: 80px;
    border: 2px dashed #90caf9;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #e3f2fd;
    transition: all 0.2s;
}

.party-slot.filled {
    border-style: solid;
    border-color: #2196f3;
    background-color: #bbdefb;
}

.party-slot.drop-target {
    border-color: #ff9800;
    box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.5);
    background-color: #ffe0b2;
}

.party-slot .char-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
}

#character-details {
    flex: 1;
    min-height: 0;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 15px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

#details-content {
    text-align: center;
    flex-grow: 1;
}

#details-content .char-image {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
    border: 3px solid #ddd;
}

#details-content h4 {
    margin: 5px 0;
    font-size: 1.5em;
    color: #333;
}

#details-content small {
    color: #666;
}

.status-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin-top: 15px;
    text-align: left;
}

.status-list p {
    margin: 0;
    font-size: 0.9em;
}

.status-list strong {
    color: #555;
}

#details-content h5 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: #3f51b5;
    border-bottom: 1px solid #c5cae9;
    padding-bottom: 5px;
}

#details-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#details-content li {
    margin-bottom: 5px;
    font-size: 0.9em;
    text-align: left;
    position: relative;
}

#details-content .skill-name {
    font-weight: bold;
    color: #00796b;
    cursor: help;
    position: relative;
}

.skill-tooltip {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px 0;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.8em;
    line-height: 1.4;
}

.skill-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

#details-content .skill-name:hover .skill-tooltip,
#details-content .skill-name:hover ~ .skill-tooltip {
    visibility: visible;
    opacity: 1;
}

#details-content .skill-tooltip {
    pointer-events: none;
}

.placeholder {
    color: #999;
    font-style: italic;
    margin-top: 50px;
}

/* パーティー編成スロットの視覚的補助 */
.party-slot.highlight {
    border: 2px solid #ffeb3b;
    box-shadow: 0 0 10px 5px rgba(255, 235, 59, 0.5);
    transform: scale(1.05);
}