* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

h1 {
    font-size: 24px;
    color: #2c3e50;
}

.header-buttons {
    display: flex;
    gap: 10px;
}

.help-btn,
.save-btn,
.upload-btn,
.output-btn {
    padding: 10px 20px;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon {
    width: 16px;
    height: 16px;
    filter: brightness(0) invert(1);
}

.help-btn {
    background-color: #f39c12;
}

.help-btn:hover {
    background-color: #e67e22;
}

.save-btn {
    background-color: #2ecc71;
}

.save-btn:hover {
    background-color: #27ae60;
}

.upload-btn {
    background-color: #3498db;
}

.upload-btn:hover {
    background-color: #2980b9;
}

.output-btn {
    background-color: #3498db;
}

.output-btn:hover {
    background-color: #2980b9;
}

.flow-area {
    display: flex;
    gap: 20px;
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    min-height: 600px;
    overflow-x: auto;
}

.flow-column {
    min-width: 300px;
    flex-shrink: 0;
    padding: 20px;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    background-color: #fafafa;
}

.flow-column:nth-child(1) {
    background-color: #e8f4f8;
}

.flow-column:nth-child(2) {
    background-color: #fff4e6;
}

.flow-column:nth-child(3) {
    background-color: #f0f8f0;
}

.flow-column:nth-child(4) {
    background-color: #fef5f5;
}

.flow-column:nth-child(5) {
    background-color: #f5f0ff;
}

.flow-column:nth-child(n+6) {
    background-color: #fafafa;
}

h2 {
    font-size: 18px;
    margin-bottom: 20px;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.flow-nodes {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    min-height: 400px;
}

.node {
    padding: 10px;
    background-color: white;
    border: 2px solid #bdc3c7;
    border-radius: 5px;
    transition: all 0.3s;
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

.node:hover {
    border-color: #3498db;
    background-color: #ecf6fc;
    transform: translateX(5px);
    box-shadow: 0 3px 8px rgba(52, 152, 219, 0.3);
}

.node.active {
    border-color: #3498db;
    background-color: #ecf6fc;
    box-shadow: 0 3px 8px rgba(52, 152, 219, 0.5);
    border-width: 3px;
}

.node.has-children::after {
    content: '▶';
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    color: #3498db;
    font-size: 12px;
}

.arrow {
    text-align: center;
    font-size: 20px;
    color: #3498db;
    margin: 5px 0;
    padding: 5px 0;
    transition: all 0.3s;
}

.arrow.arrow-drop-target {
    background-color: #2ecc71;
    color: white;
    border-radius: 5px;
    transform: scale(1.2);
}

.node-empty {
    opacity: 0.6;
}

.node.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.node.drag-over-top {
    border-top: 3px solid #2ecc71;
}

.node.drag-over-bottom {
    border-bottom: 3px solid #2ecc71;
}

.node[draggable="true"] {
    cursor: grab;
}

.node-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    color: #2c3e50;
    padding: 5px;
    outline: none;
}

.node-input:focus {
    background-color: white;
    border: 1px solid #3498db;
    border-radius: 3px;
}

.node-delete-btn {
    width: 24px;
    height: 24px;
    border: none;
    background-color: #e74c3c;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
    flex-shrink: 0;
}

.node-delete-btn:hover {
    background-color: #c0392b;
}

.add-node-btn {
    width: 100%;
    padding: 10px;
    background-color: #2ecc71;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.add-node-btn:hover {
    background-color: #27ae60;
}

/* 空の状態 */
.empty-message {
    text-align: center;
    color: #95a5a6;
    padding: 40px;
    font-style: italic;
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    min-width: 400px;
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.modal-content input[type="file"] {
    width: 100%;
    padding: 10px;
    margin-bottom: 20px;
    border: 2px solid #bdc3c7;
    border-radius: 5px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
}

.modal-buttons button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    color: white;
    font-weight: bold;
    transition: background-color 0.3s;
}

#uploadConfirmBtn {
    background-color: #3498db;
}

#uploadConfirmBtn:hover {
    background-color: #2980b9;
}

#uploadCancelBtn {
    background-color: #95a5a6;
}

#uploadCancelBtn:hover {
    background-color: #7f8c8d;
}

/* 使い方モーダル */
.help-modal-content {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.help-content {
    margin-bottom: 20px;
}

.help-content p {
    line-height: 1.8;
    margin-bottom: 15px;
}

.help-content h4 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: #2c3e50;
    font-size: 16px;
    border-bottom: 1px solid #ecf0f1;
    padding-bottom: 5px;
}

.help-content h4:first-child {
    margin-top: 0;
}

.help-content ul {
    margin-left: 20px;
    margin-top: 10px;
}

.help-content li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.help-content li ul {
    margin-top: 5px;
}

.help-content strong {
    color: #2c3e50;
}

#helpCloseBtn {
    width: 100%;
    background-color: #3498db;
}

#helpCloseBtn:hover {
    background-color: #2980b9;
}
