/* 上部 */
.top-controls {
    display: flex;
    gap: 15px;
    padding: 20px;
    background: rgba(66,77,113,1);
    border-radius: 10px;
    margin: 20px;
    justify-content: center;
    align-items: center;
}

.top-controls button {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
}

/* おまかせボタンのグレーアウト */
.btn-disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
}

.btn-disabled:hover {
    background: #28a745 !important;
    transform: none !important;
}

/* 依頼エリア */
.commissions-area {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px;
}

/* 依頼スロット */
.commission-slot {
    background: rgba(66,77,113,1);
    border-radius: 10px;
    padding: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.commission-header {
    margin-bottom: 0px;
}

.commission-select-btn {
    width: 128px;
    height: 128px;
    background: white;
    border: 2px solid #8090cf;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.commission-select-btn:hover {
    background: #f0f0ff;
    border-color: #40539f;
}

.commission-select-btn.selected {
    border-style: solid;
    background-size: cover;
    background-position: center;
}

.commission-select-text {
    font-size: 16px;
    font-weight: bold;
    color: #252a42;
}

.commission-select-btn.selected .commission-select-text {
    display: none;
}

/* 依頼名ツールチップ */
.commission-name-badge {
    position: absolute;
    bottom: 5px;
    left: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px;
    font-size: 12px;
    font-weight: bold;
    border-radius: 4px;
    text-align: center;
}

/* 要件セクション */
.commission-requirements {
    margin-bottom: 0px;
}

.requirement-section {
    margin-bottom: 0px;
}

.requirement-title {
    font-size: 0px;
    font-weight: bold;
    color: #252a42;
    margin-bottom: 4px;
}

.requirement-badges {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.requirement-badge {
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: bold;
    background: #e0e0e0;
    color: #666;
    transition: all 0.3s;
}

.requirement-badge.active {
    background: #ff7700;
    color: white;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

/* ロール+キャラスロ統合コンテナ */
.character-slots-with-roles {
    display: flex;
    gap: 5px;
    justify-content: space-between;
    margin-top: 5px;
}

.role-character-container {
    flex: 1;
    border-radius: 10px;
    padding: 5px;
    transition: all 0.3s;
    
    /* デフォルト（未配置） */
    background: #ffffff;
}

/* ロール別の背景色 - 未配置 */
.role-character-container.role-vanguard {
    background: #ffd2e3; /* アタッカー */
}

.role-character-container.role-versatile {
    background: #cfd1ff; /* バランサー */
}

.role-character-container.role-support {
    background: #d2fff6; /* サポーター */
}

/* ロール別の背景色 - 配置済 */
.role-character-container.role-vanguard.has-character {
    background: #db6893; 
}

.role-character-container.role-versatile.has-character {
    background: #7d81e3; 
}

.role-character-container.role-support.has-character {
    background: #41cbaf; 
}

/* ロールラベル */
.role-label {
    text-align: center;
    font-size: 14px;
    font-weight: bold;
    color: #252a42;
    margin-bottom: 4px;
    min-height: 4px;
}

/* 配置済みの時はラベルを白色に */
.role-character-container.has-character .role-label {
    color: white;
}

/* キャラクタースロット */
.character-slots {
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.character-slot-item {
    aspect-ratio: 1;
    background: white;
    border: 2px solid white;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

/* 統合コンテナ内のキャラスロ */
.role-character-container .character-slot-item {
    width: 100%;
}

.character-slot-item:hover {
    border-color: rgba(66,77,113,0.5);
    background: #f0f0ff;
}

.character-slot-item.filled {
    border-style: solid;
    border-color: rgba(66,77,113,0.5);
}

.character-slot-item.disabled {
    opacity: 1;
    cursor: not-allowed;
    pointer-events: none;
    background: #ffffff;
}

.character-slot-placeholder {
    font-size: 48px;
    color: #ddd;
    font-weight: bold;
}

.character-slot-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.character-slot-item.anything {
    background: linear-gradient(135deg, #ff8800 50%, #ff2200 100%);
    border-color: #ff8800;
}

.character-slot-item.anything .character-slot-placeholder {
    color: #ffffff;
    font-size: 16px;
}

/* プリセット */
.presets-area {
    padding: 16px;
    background: #f0f0ff;
    border-radius: 10px;
    margin: 20px 0;
    max-width: 100%;
    box-sizing: border-box;
}

.presets-area h3 {
    color: #252a42;
    margin-bottom: 8px;
    font-size: 20px;
}

.presets-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    align-items: start;
}

.preset-item {
    background: white;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.preset-thumbnail {
    position: relative;
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #252a42 0%, #424d71 100%);
    border-radius: 4px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 3px;
    padding: 3px;
    flex-shrink: 0;
    overflow: hidden;
}

.preset-thumbnail.empty {
    display: flex;
    align-items: center;
    justify-content: center;
}

.preset-commission-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 3px;
    background: white;
}

.preset-number {
    font-size: 24px;
    color: white;
    font-weight: bold;
}

.preset-actions {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.preset-actions button {
    padding: 8px 12px;
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

/* 依頼選択モーダル */
.commission-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.commission-modal.open {
    display: block;
}

.commission-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1;
}

.commission-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 10px;
    padding: 20px;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    width: 90%;
    z-index: 2;
}

.commission-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #252a42;
    padding-bottom: 10px;
}

.commission-modal-title {
    font-size: 20px;
    color: #252a42;
    margin: 0;
}

.commission-modal-close {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: #424d71;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
}

.commission-modal-close:hover {
    color: #252a42;
}

.commission-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.commission-option {
    aspect-ratio: 1;
    background: #f0f0ff;
    border: 2px solid #d5cdc7;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.commission-option:hover {
    border-color: #635b58;
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(99,91,88,0.25);
}

.commission-option.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.commission-option.disabled:hover {
    border-color: #ddd;
    transform: none;
    box-shadow: none;
}

.commission-option-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.commission-option-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px;
    font-size: 14px;
    text-align: center;
    font-weight: bold;
}

/* キャラクター選択モーダル */
.character-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.character-modal.open {
    display: block;
}

.character-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1;
}

.character-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 10px;
    padding: 20px;
    max-width: 850px;
    max-height: 80vh;
    overflow-y: auto;
    width: 90%;
    z-index: 2;
}

.character-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #252a42;
    padding-bottom: 10px;
}

.character-modal-title {
    font-size: 20px;
    color: #252a42;
    margin: 0;
}

.character-modal-close {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: #424d71;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
}

.character-modal-close:hover {
    color: #252a42;
}

.character-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 16px;
}

.character-option {
    aspect-ratio: 1;
    background: white;
    border: 2px solid #d5cdc7;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.character-option:hover:not(.disabled) {
    border-color: #40539f;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(64,83,159,0.5);
}

.character-option.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.character-option-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 性格ツールチップは常時表示（opacity） */
.character-option-name {
    position: absolute;
    bottom: 0px;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px;
    font-size: 12px;
    text-align: center;
    font-weight: bold;
    opacity: 1;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 10;
    line-height: 1.3;
}

.character-option:hover .character-option-name {
    opacity: 1;
}

/* 所持キャラクター管理モーダル */
.owned-characters-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.owned-characters-modal.open {
    display: block;
}

.owned-characters-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1;
}

.owned-characters-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 10px;
    padding: 20px;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    width: 90%;
    z-index: 2;
}

.owned-characters-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #252a42;
    padding-bottom: 10px;
}

.owned-characters-modal-title {
    font-size: 20px;
    color: #252a42;
    margin: 0;
}

.owned-characters-modal-close {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: #424d71;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
}

.owned-characters-modal-close:hover {
    color: #252a42;
}

.owned-characters-modal-body {
    color: #252a42;
    line-height: 1.8;
    padding: 0 8px 8px 8px;
    overflow-y: auto;
    flex: 1;
}

.owned-characters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    width: 100%;
    max-width: 100%;
}

.owned-character-option {
    aspect-ratio: 1;
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.owned-character-option:hover {
    transform: scale(1.05);
}

.owned-character-option.inactive {
    opacity: 0.3;
    filter: grayscale(100%);
}

.owned-character-option.active {
    border-color: rgba(213,205,199,1);
    box-shadow: 0 4px 12px rgba(99,91,88,0.5);
}

/* ホバーでロール+性格を表示させるツールチップ */
.owned-character-tooltip {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px;
    font-size: 9px;
    text-align: center;
    font-weight: bold;
    opacity: 1;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 10;
    line-height: 1.3;
}

.owned-character-option:hover .owned-character-tooltip {
    opacity: 1;
}

/* おまかせ結果モーダル */
.auto-assign-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.auto-assign-modal.open {
    display: block;
}

.auto-assign-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1;
}

.auto-assign-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 10px;
    padding: 20px;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    width: 90%;
    z-index: 2;
}

.auto-assign-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #252a42;
    padding-bottom: 10px;
}

.auto-assign-modal-title {
    font-size: 20px;
    color: #252a42;
    margin: 0;
}

.auto-assign-modal-close {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: #424d71;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
}

.auto-assign-modal-close:hover {
    color: #252a42;
}

.auto-assign-modal-body {
    color: #252a42;
    line-height: 1.8;
    padding: 0 8px 8px 8px;
    overflow-y: auto;
    flex: 1;
}

/* 成功時のメッセージ（ヘッダー） */
.auto-assign-success-header {
    background: linear-gradient(135deg, #252a42 0%, #424d71 100%);
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.auto-assign-success-icon {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    object-fit: cover;
    border: 0px solid white;
    flex-shrink: 0;
}

.auto-assign-success-message {
    color: white;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
}

/* 候補カード */
.auto-assign-result {
    background: #ffffff;
    border: 2px solid #ff8800;
    border-radius: 8px;
    padding: 4px;
    margin: 0 auto 12px auto; /* 中央寄せ */
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

.auto-assign-result:hover {
    background: #ffeecc;
    box-shadow: 0 4px 12px rgba(255, 170, 0, 0.3);
}

.auto-assign-commissions {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    justify-content: center;
}

.auto-assign-commission {
    background: white;
    border-radius: 6px;
    padding: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #e0e0e0;
    width: fit-content; /* 中身に合わせた幅 */
}

.auto-assign-commission-icon {
    /* clamp(最小, 推奨, 最大) で画面幅に応じて自動調整 */
    width: clamp(32px, 8vw, 64px);
    height: clamp(32px, 8vw, 64px);
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid rgba(99,91,88,0.5);
    flex-shrink: 0;
}

.auto-assign-commission-name {
    font-weight: bold;
    font-size: 12px;
    margin-bottom: 4px;
    color: #635b58;
}

.auto-assign-characters {
    display: flex;
    gap: 2px;
    flex-wrap: nowrap;
    align-items: center;
}

.auto-assign-character-icon {
    /* clamp(最小, 推奨, 最大) で画面幅に応じて自動調整 */
    width: clamp(32px, 8vw, 64px);
    height: clamp(32px, 8vw, 64px);
    border-radius: 5px;
    object-fit: cover;
    border: 1px solid #ddd;
    flex-shrink: 0;
}

/* スマホでは縦並びに */
@media (max-width: 768px) {
    .auto-assign-commissions {
        flex-direction: column;
        align-items: center;
    }
}

.auto-assign-error {
    background: #fff0f0;
    border: 2px solid #ff6b6b;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.auto-assign-error h4 {
    color: #ff6b6b;
    margin-bottom: 10px;
}

.missing-characters {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 15px;
}

.missing-character-icon {
    width: 80px;
    height: 80px;
    border-radius: 5px;
    object-fit: cover;
    border: 2px solid #ff6b6b;
}

/* おまかせ失敗時の不足キャラクター */
.missing-characters-section {
    margin-top: 8px;
    margin-bottom: 8px;
}

.missing-group {
    margin-bottom: 8px;
}

.missing-group-title {
    color: #252a42;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 4px;
    text-align: center;
}

/* 候補コンテナ（1パターンごとにボックスで分割） */
.missing-candidates-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 8px;
}

.missing-candidate-item {
    background: #fff5e6;
    border: 2px solid #424d71;
    border-radius: 8px;
    padding: 4px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

/*
.missing-candidate-item:hover {
    background: #ffe4b3;
    box-shadow: 0 0px 0px rgba(102, 126, 234, 0.3);
    transform: translateY(0px);
}
*/

.missing-candidate-icons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0px;
    flex-wrap: wrap;
}

.missing-character-icon-box {
    width: 64px;
    height: 64px;
    border-radius: 4px;
    object-fit: cover;
    border: 2px solid #666666;
}

.candidate-plus {
    font-size: 32px;
    font-weight: bold;
    color: #ff6600;
    padding: 0 4px;
}

/* 使い方モーダル */
.usage-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.usage-modal.open {
    display: block;
}

.usage-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1;
}

.usage-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 10px;
    padding: 20px;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    width: 90%;
    z-index: 2;
}

.usage-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #252a42;
    padding-bottom: 10px;
}

.usage-modal-title {
    font-size: 20px;
    color: #252a42;
    margin: 0;
}

.usage-modal-close {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: #424d71;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
}

.usage-modal-close:hover {
    color: #252a42;
}

.usage-modal-body {
    color: #252a42;
    line-height: 1.8;
    padding: 0 8px 8px 8px;
    overflow-y: auto;
    flex: 1;
}

.usage-modal-body h3 {
    font-size: 18px;
    color: #252a42;
    margin-top: 0;
    margin-bottom: 15px;
}

.usage-modal-body p {
    margin-bottom: 16px;
}

.usage-modal-body strong {
    color: #252a42;
}

/* レスポンシブ対応 */

/* タブレット */
@media (max-width: 1024px) {
    .commissions-area {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 15px;
    }
    
    .presets-area {
        margin: 15px;
    }
    
    .presets-list {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (max-width: 768px) {
    /* 依頼エリア - 1列 */
    .commissions-area {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 12px;
    }
    
    /* 上部コントロール */
    .top-controls {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
        margin: 12px;
    }
    
    .top-controls button {
        width: 100%;
        padding: 14px 20px;
        font-size: 15px;
        min-height: 48px;
    }
    
    /* 依頼スロット */
    .commission-slot {
        padding: 12px;
    }
    
    .commission-select-btn {
        width: 140px;
        height: 140px;
    }
    
    /* キャラクタースロット */
    .character-slots-with-roles {
        gap: 4px;
    }
    
    .role-character-container {
        padding: 4px;
    }
    
    .role-label {
        font-size: 12px;
    }
    
    /* プリセット */
    .presets-area {
        margin: 12px;
        padding: 12px;
    }
    
    .presets-list {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .preset-item {
        padding: 8px;
        gap: 8px;
    }
    
    .preset-thumbnail {
        width: 80px;
        height: 80px;
    }
    
    .preset-actions button {
        padding: 10px 10px;
        font-size: 13px;
        min-height: 40px;
    }
    
    /* モーダル */
    .commission-modal-content,
    .character-modal-content,
    .owned-characters-modal-content,
    .usage-modal-content {
        width: 95%;
        max-height: 85vh;
        padding: 15px;
    }
    
    .commission-modal-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 6px;
    }
    
    .character-modal-grid,
    .owned-characters-grid {
        grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
        gap: 6px;
    }
    
    /* おまかせ結果モーダル */
    .auto-assign-modal-content {
        width: 90%;
        max-width: 700px;
        padding: 12px;
    }
    
    .auto-assign-commissions {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .auto-assign-commission {
        flex-wrap: nowrap;
        align-items: flex-start;
        padding: 8px;
    }
    
    .auto-assign-commission-icon {
        width: 60px;
        height: 60px;
    }
    
    .auto-assign-character-icon {
        width: 50px;
        height: 50px;
    }
    
    .auto-assign-success-header {
        flex-direction: column;
        padding: 12px;
        gap: 10px;
    }
    
    .auto-assign-success-icon {
        width: 64px;
        height: 64px;
    }
}

/* スマートフォン */
@media (max-width: 480px) {
    .commissions-area {
        padding: 10px;
        gap: 12px;
    }
    
    .top-controls {
        margin: 10px;
        padding: 12px;
    }
    
    .commission-slot {
        padding: 10px;
    }
    
    .commission-select-btn {
        width: 120px;
        height: 120px;
    }
    
    .commission-select-text {
        font-size: 14px;
    }
    
    .commission-name-badge {
        font-size: 12px;
        padding: 4px;
    }
    
    .requirement-title {
        font-size: 12px;
    }
    
    .requirement-badge {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    /* プリセット */
    .presets-area {
        margin: 10px;
        padding: 10px;
    }
    
    .presets-area h3 {
        font-size: 16px;
    }
    
    .presets-list {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .preset-thumbnail {
        width: 60px;
        height: 60px;
    }
    
    .preset-actions button {
        padding: 8px 8px;
        font-size: 12px;
    }
    
    /* モーダル */
    .commission-modal-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
    }
    
    /* おまかせ結果モーダル（スマホ）- clampで自動調整されるので最小限の調整 */
    .auto-assign-commissions {
        gap: 6px;
    }
    
    .auto-assign-commission {
        padding: 4px;
        gap: 4px;
    }
    
    .auto-assign-result {
        padding: 8px;
    }
    
    .character-modal-grid,
    .owned-characters-grid {
        grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
        gap: 5px;
    }
    
    .commission-modal-title,
    .character-modal-title,
    .owned-characters-modal-title,
    .usage-modal-title,
    .auto-assign-modal-title {
        font-size: 16px;
    }
    
    .commission-modal-close,
    .character-modal-close,
    .owned-characters-modal-close,
    .usage-modal-close,
    .auto-assign-modal-close {
        width: 36px;
        height: 36px;
        font-size: 24px;
    }
    
    /* 不足キャラクター */
    .missing-candidates-container {
        grid-template-columns: 1fr;
    }
    
    .missing-character-icon-box {
        width: 48px;
        height: 48px;
    }
    
    .candidate-plus {
        font-size: 24px;
    }
}

/* 小型スマホ（iPhone SE等） */
@media (max-width: 374px) {
    .commission-select-btn {
        width: 100px;
        height: 100px;
    }
    
    .presets-list {
        grid-template-columns: 1fr;
    }
    
    .preset-item {
        flex-direction: row;
    }
    
    .commission-modal-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .character-modal-grid,
    .owned-characters-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ユーティリティ */

.hidden {
    display: none !important;
}

.error-message {
    background: #ff6b6b;
    color: white;
    padding: 15px;
    margin: 20px;
    border-radius: 8px;
    text-align: center;
    font-weight: bold;
}
